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