referencing external functions
| From: | J. Connolly | Date: | Tue, 15 Feb 2005 17:45:29 +0000 |
| Subject: | referencing external functions | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38583@lists.php.net to get a copy of this message | ||
Sorry if this is a duplicate. I accidentally sent to the listserve from the wrong address.
I am having trouble calling external functions. I am trying to use this to clean up the code in the display. I have this as the function.php
<?php
function connect() {
global $link;
$link = mysql_connect("localhost","username","password")
or die ("Could not Connect to DB");
mysql_select_db("database",$link) or die (mysql_error());
}
function links() {
global $link;
$sql = "select * from jozef_links";
$result = mysql_query($sql, $link) or die (mysql_error());
echo "<li>";
while ($array = mysql_fetch_array($result)) {
$id = $array['link_name'];
$url= $array['link_url'];
echo "<ul><a href=\"$url\">$id</a></ul>\n";
}
echo "</li>";
}
?>
and am trying to use it in this links3.php
<?php
include('functions.php') or die (mysql_error());
?>
but I keep getting the error message
*Warning*: main(1): failed to open stream: No such file or directory in *C:\Accounts\dbadream\wwwRoot\links3.php* on line *4*
*Warning*: main(): Failed opening '1' for inclusion (include_path='.;c:\php4\pear') in *C:\Accounts\dbadream\wwwRoot\links3.php* on line *4*
Can anyone explain what is wrong. Both files are in the same directory and and both have the normal permissions set to access.
Thanks,
jzf