Weird problem when creating a db connection and trying to reference it in a function
| From: | Matt Babineau | Date: | Fri, 24 Oct 2003 20:21:48 +0000 |
| Subject: | Weird problem when creating a db connection and trying to reference it in a function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-167503@lists.php.net to get a copy of this message | ||
Hey all-
I found another strange problem. I am creating a mysql database
connection like this:
@ $db = mysql_pconnect(host, user, pass);
mysql_select_db(dbname);
Now, I have a function that inside uses mysql_list_fields()
function getFields($table, $dbname) {
$fields = mysql_list_fields($dbname, $table);
return $fields;
}
The problem is this always errors saying it cant find the database.
However, if I ran a mysql_query("select * from users") function, it
would work fine.
Any ideas on what the deal is with this function??
Thanks,
Matt