RE: [PHP] mysql_list_fields() bug?

From: Date: Mon, 10 Nov 2003 20:08:07 +0000
Subject: RE: [PHP] mysql_list_fields() bug?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169100@lists.php.net to get a copy of this message
Ok, this ended up working well. I'm still wondering why in my example function two() works, without needing to provide the resource identifier to mysql_query(), how can mysql_query() pick up the resource identifier automatically while mysql_list_fields does not? Thx- Matt On Mon, 2003-11-10 at 17:00, Jay Blanchard wrote: > [snip] > Ok, I added the resource identifier, and got an error. I think what is > happening now is the resource identifier $db is outside the function > one(), so it cannot be referenced from the mysql_list_fields() fuction > which is inside. Does that make sense? Is the resource indentifier a > GLOBAL thing, because I sure didn't make it one :) The error I got was, > "supplied argument is not a valid Mysql-Link resource". > [/snip] > > Add GLOBAL to the function .... > > function one() { > global $db; > mysql_select_db("db"); > $fields = mysql_list_fields("db", "table", $db); > }

« previous php.general (#169100) next »