mysql_list_fields() bug?
| From: | Matt Babineau | Date: | Mon, 10 Nov 2003 18:34:32 +0000 |
| Subject: | mysql_list_fields() bug? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-169090@lists.php.net to get a copy of this message | ||
Hey All -
just wanted to check in with anyone who has used this function. I
currectly have a function that I created, and inside it I have this
function.
Outside of my custom function I have a mysql_pconnect() statement and a
mysql_select_db() statement.
I also have another custom function that runs a SQL query and returns
the results.
My problem is why does the custom function with mysql_list_fields(),
fail to run unless I put a separate pconnect and select_db statement in
the custom function itself and my other custom function can query the DB
fine.
$db = mysql_pconnect("ip", "user", "password");
mysql_select_db("db");
function one() {
$db = mysql_pconnect("ip", "user", "password");
mysql_select_db("db");
$fields = mysql_list_fields("db", "table");
}
function two() {
$q = "SELECT * FROM user";
$result = mysql_query($q);
return $result;
}
So the end result being if I take the connect statement out of the
function one(), it fails, but function two() still works!
Am I doing something wrong here?
Thanks,
Matt