From kyedza@sdf.lonestar.org Wed Mar 2 10:08:18 2005 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5074E52A52 for ; Wed, 2 Mar 2005 10:08:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01323-01 for ; Wed, 2 Mar 2005 10:08:11 +0000 (GMT) Received: from smtp001.mail.ukl.yahoo.com (smtp001.mail.ukl.yahoo.com [217.12.11.32]) by svr1.postgresql.org (Postfix) with SMTP id BB47E55CF9 for ; Wed, 2 Mar 2005 10:08:09 +0000 (GMT) Received: from unknown (HELO devt.yahoo.co.uk) (kyedza@81.199.24.21 with login) by smtp001.mail.ukl.yahoo.com with SMTP; 2 Mar 2005 10:07:59 -0000 Message-Id: <6.1.0.6.0.20050302123253.02422c88@mail.freeshell.org> X-Sender: kyedza@mail.freeshell.org X-Mailer: QUALCOMM Windows Eudora Version 6.1.0.6 Date: Wed, 02 Mar 2005 12:43:53 +0300 To: pgsql-php@postgresql.org From: "Sarah, Godfrey, Matthew & Vera" Subject: PHP function error In-Reply-To: <422550A0.2040104@sherubtse.edu.bt> References: <422550A0.2040104@sherubtse.edu.bt> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; x-avg-checked=avg-ok-60C65853 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200503/7 X-Sequence-Number: 3022 I am trying to run the following code but get the following error: Fatal error: Call to undefined function show_title() in d:\webhost\build\index.php on line 13 This file is called "index.php" <? show_title($id); ?> The other file "dynamic.php" has the following functions /* dynamic.inc.php */ function show_title($id) { $fp = fopen(get_filename($id), "r"); if (!$fp) return; $line = trim(fgets($fp, 255)); fclose($fp); echo $line; } function get_filename($id) { $name = "file_$id.txt"; if (file_exists($name)) { return $name; } else { return "error.txt"; } } function show_navigation($id) { global $PHP_SELF, $SCRIPT_NAME; if (trim($PHP_SELF) == "") $PHP_SELF = $SCRIPT_NAME; $dir = opendir('.'); if (!$dir) return; while ($file = readdir($dir)) { if ( (ereg("^file_.*\.txt$", $file)) and (is_file($file)) ) { $item = ereg_replace("^file_(.*)\.txt$", "\\1", $file); echo ''.$item."\n"; if ($id == $item) { echo "<=="; } echo "
\n"; } } } function show_content($id) { $fp = fopen(get_filename($id), "r"); if (!$fp) return; $first = true; while (!feof($fp)) { if ($fp) { $line = fgets($fp, 1024); if ($first) { $first = false; } else { echo $line; } } } fclose($fp); } From graeme_foster@sherubtse.edu.bt Wed Mar 2 11:26:42 2005 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AB58C52A73 for ; Wed, 2 Mar 2005 11:26:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23737-03 for ; Wed, 2 Mar 2005 11:26:33 +0000 (GMT) Received: from sisterOfProxy.sherubtse.edu.bt (mail.sherubtse.edu.bt [202.144.141.18]) by svr1.postgresql.org (Postfix) with ESMTP id E499452A4F for ; Wed, 2 Mar 2005 11:26:24 +0000 (GMT) Received: from [127.0.0.1] ([192.168.1.236]) by sisterOfProxy.sherubtse.edu.bt (8.12.10/8.12.10) with ESMTP id j22BUBj0018344; Wed, 2 Mar 2005 17:30:14 +0600 Message-ID: <4225A2DB.2090509@sherubtse.edu.bt> Date: Wed, 02 Mar 2005 17:26:19 +0600 From: graeme User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Sarah, Godfrey, Matthew & Vera" Cc: pgsql-php@postgresql.org Subject: Re: PHP function error References: <422550A0.2040104@sherubtse.edu.bt> <6.1.0.6.0.20050302123253.02422c88@mail.freeshell.org> In-Reply-To: <6.1.0.6.0.20050302123253.02422c88@mail.freeshell.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/8 X-Sequence-Number: 3023 Is dynamic.php in the same directory as index.php, switch your stetement from include to require if it fails to find it them you'll learn where it is looking for the file. Just for future reference some servers require you php tags to be written as graeme. Sarah, Godfrey, Matthew & Vera wrote: > I am trying to run the following code but get the following error: > > Fatal error: Call to undefined function show_title() in > d:\webhost\build\index.php on line 13 > > > This file is called "index.php" > > > > > > > <? show_title($id); ?> > > > > > > > > The other file "dynamic.php" has the following functions > > /* dynamic.inc.php */ > > > function show_title($id) > { > $fp = fopen(get_filename($id), "r"); > if (!$fp) return; > $line = trim(fgets($fp, 255)); > fclose($fp); > echo $line; > } > > > > function get_filename($id) > { > $name = "file_$id.txt"; > if (file_exists($name)) > { > return $name; > } else { > return "error.txt"; > } > } > > > function show_navigation($id) > { > global $PHP_SELF, $SCRIPT_NAME; > if (trim($PHP_SELF) == "") $PHP_SELF = $SCRIPT_NAME; > $dir = opendir('.'); > if (!$dir) return; > while ($file = readdir($dir)) > { > if ( (ereg("^file_.*\.txt$", $file)) and (is_file($file)) ) > { > $item = ereg_replace("^file_(.*)\.txt$", "\\1", $file); > echo ' href="'.$PHP_SELF.'?id='.urlencode($item).'">'.$item."\n"; > if ($id == $item) > { > echo "<=="; > } > echo "
\n"; > } > } > } > > > > function show_content($id) > { > $fp = fopen(get_filename($id), "r"); > if (!$fp) return; > $first = true; > while (!feof($fp)) > { > if ($fp) > { > $line = fgets($fp, 1024); > if ($first) > { > $first = false; > } else { > echo $line; > } > } > } > fclose($fp); > } > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim From kyedza@sdf.lonestar.org Wed Mar 2 13:33:00 2005 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 056E356631 for ; Wed, 2 Mar 2005 13:33:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60952-01 for ; Wed, 2 Mar 2005 13:32:53 +0000 (GMT) Received: from smtp001.mail.ukl.yahoo.com (smtp001.mail.ukl.yahoo.com [217.12.11.32]) by svr1.postgresql.org (Postfix) with SMTP id 27D1756630 for ; Wed, 2 Mar 2005 13:32:52 +0000 (GMT) Received: from unknown (HELO devt.yahoo.co.uk) (kyedza@81.199.24.21 with login) by smtp001.mail.ukl.yahoo.com with SMTP; 2 Mar 2005 13:32:52 -0000 Message-Id: <6.1.0.6.0.20050302163052.024b7ec0@mail.freeshell.org> X-Sender: kyedza@mail.freeshell.org X-Mailer: QUALCOMM Windows Eudora Version 6.1.0.6 Date: Wed, 02 Mar 2005 16:31:58 +0300 To: pgsql-php@postgresql.org From: "Sarah, Godfrey, Matthew & Vera" Subject: Re: [**POSSIBLE SPAM**] PHP function error In-Reply-To: <003901c51f1d$b0f472d0$3b00a8c0@majolee9> References: <422550A0.2040104@sherubtse.edu.bt> <6.1.0.6.0.20050302123253.02422c88@mail.freeshell.org> <003901c51f1d$b0f472d0$3b00a8c0@majolee9> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; x-avg-checked=avg-ok-724764B8 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200503/9 X-Sequence-Number: 3024 At 02:47 PM 3/2/2005, you wrote: >the file name in your include is wrong please use dynamic.inc.php instead of >dynamic.php > >:) Thanks but that is what I started with and still it could not work. Let me do that again. Godfrey From fbax@sympatico.ca Wed Mar 2 13:54:30 2005 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 10CF356139 for ; Wed, 2 Mar 2005 13:54:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64273-09 for ; Wed, 2 Mar 2005 13:54:24 +0000 (GMT) Received: from tomts36-srv.bellnexxia.net (tomts36.bellnexxia.net [209.226.175.93]) by svr1.postgresql.org (Postfix) with ESMTP id D328A55CF9 for ; Wed, 2 Mar 2005 13:54:22 +0000 (GMT) Received: from acer.sympatico.ca ([65.95.169.24]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050302135423.PDFK1694.tomts36-srv.bellnexxia.net@acer.sympatico.ca> for ; Wed, 2 Mar 2005 08:54:23 -0500 Message-Id: <5.2.1.1.0.20050302084822.049cfb60@pop6.sympatico.ca> X-Sender: b1wudu74@pop6.sympatico.ca X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Wed, 02 Mar 2005 08:53:26 -0500 To: pgsql-php@postgresql.org From: Frank Bax Subject: Re: PHP function error In-Reply-To: <6.1.0.6.0.20050302123253.02422c88@mail.freeshell.org> References: <422550A0.2040104@sherubtse.edu.bt> <422550A0.2040104@sherubtse.edu.bt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/12 X-Sequence-Number: 3027 At 04:43 AM 3/2/05, Sarah, Godfrey, Matthew & Vera wrote: >I am trying to run the following code but get the following error: > >Fatal error: Call to undefined function show_title() in >d:\webhost\build\index.php on line 13 > > >This file is called "index.php" > > > > >< >The other file "dynamic.php" has the following functions > >/* dynamic.inc.php */ Five (at least) problems: 1) you error message says that error occured on line 13 of index.php, but the index.php file you show us does not have 13 lines in it. 2) You say the include file is called "dynamic.php", but the first line of that file has "dynamic.inc.php" - which is it. 3) You should normally use "require" instead of "include" in this situation. 4) I'm guessing you are running with "register_globals" on, which not a good idea; if it is off, the above code (line wid $id) will not work. 5) These problems have nothing to do with PostgresSQL, so this post is off-topic. I suggest you find a php newbie list. From kyedza@sdf.lonestar.org Wed Mar 2 14:05:43 2005 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F4D35567D for ; Wed, 2 Mar 2005 14:05:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68366-09 for ; Wed, 2 Mar 2005 14:05:34 +0000 (GMT) Received: from smtp002.mail.ukl.yahoo.com (smtp002.mail.ukl.yahoo.com [217.12.11.33]) by svr1.postgresql.org (Postfix) with SMTP id 0E34252A68 for ; Wed, 2 Mar 2005 14:05:33 +0000 (GMT) Received: from unknown (HELO devt.yahoo.co.uk) (kyedza@81.199.24.21 with login) by smtp002.mail.ukl.yahoo.com with SMTP; 2 Mar 2005 14:05:34 -0000 Message-Id: <6.1.0.6.0.20050302170221.02493e78@mail.freeshell.org> X-Sender: kyedza@mail.freeshell.org X-Mailer: QUALCOMM Windows Eudora Version 6.1.0.6 Date: Wed, 02 Mar 2005 17:04:45 +0300 To: pgsql-php@postgresql.org From: "Sarah, Godfrey, Matthew & Vera" Subject: Re: PHP function error Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; x-avg-checked=avg-ok-724764B8 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200503/13 X-Sequence-Number: 3028 Hello Mr. Bax, Many thanks for your kind comments. ------- 5) These problems have nothing to do with PostgresSQL, so this post is off-topic. I suggest you find a php newbie list. ------- I guess you are saying any inquiry here should be PosgresSQL/php related. I will be careful in future. :-) Godfrey