OZONE Asylum
FAQ
Why do I get a 'Supplied argument is not a valid MySQL result resource' error?
This page's ID:
5673
Search
QuickChanges
Forums
FAQ
Archives
Register
You are editing "Why do I get a 'Supplied argument is not a valid MySQL result resource' error?"
Who can edit an FAQ?
Anyone registered may edit an FAQ.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
There are a number of possible solutions (which are largely connected with the preceeding SQL statement rather than anything on the line the error number is for (mysql_num_rows() is commonly indicated if it is being used): 1. Make sure the tables and fields exist in your SQL statement. 2. If you are passing a variable in the SQL make sure it is probably escaped (usally in single quotes, but don't forget to addslash() if it came from outside (ie. get/post/cookie) and magic_quotes_gpc is off. Look those up in [url=http://www.php.net/manual/en]the php manual[/url] if you don't know what they mean). Not doing this will generate the error: [code]$sql = "SELECT something FROM table WHERE something = $variable";[/code] and this will fix things: [code]$sql = "SELECT something FROM table WHERE something = '$variable'";[/code] Note: you could also use double quotes, but not within a double quoted string... --------------------------- Relevant links: [url=http://www.webmasterworld.com/forum13/2138.htm]PHP/MySQL error[/url] [url=http://www.experts-exchange.com/Web/Q_20525512.html]Minor mySQL troubles (in PHP)[/url] _____________________ [internallink=4626]Emperor[/internallink] [small][i](Edited by: [url=http://www.ozoneasylum.com/cgi-bin/ubbmisc.cgi?action=getbio&UserName=Tyberius+Prime]Tyberius Prime [/url] on Mon 12-May-2003)[/i][/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »