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); }