On Mon, 2003-11-10 at 16:43, Jay Blanchard wrote:
> [snip]
> Outside of my custom function I have a mysql_pconnect() statement and a
> mysql_select_db() statement.
> 
> 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?
> [/snip]
> 
> It's just a small misunderstanding Matt. Your
> 
> $db = mysql_pconnect("ip", "user", "password");
> 
> is LOCAL to the function http://us3.php.net/language.variables.scope
> 
> The other connection string you mention sits OUTSIDE of any other
> function, so it is GLOBAL (you didn't show that code). You are not
> calling for the GLOBAL connection in function one. As someone famous
> once said, "Location, location, location!"
> 
> If you add the resource identifier to the request in function one to
> 
> $fields = mysql_list_fields("db", "table", $db);
> 
> it should work just fin

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".

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to