It works on a local server but not on a remote.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in e:\vhosts\...\files\getTableContents.php on line 15
| SitePoint Sponsor |




It works on a local server but not on a remote.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in e:\vhosts\...\files\getTableContents.php on line 15
Compare bible texts (and other tools):
TheWheelofGod
It tells you, supplied argument is not a valid MySQL result resource.




Compare bible texts (and other tools):
TheWheelofGod
Check mysql_query make sure it has not errored out, as well as mysql_connect.




Correct your database details, then it will work!

If you cannot get a hold of mysql_errno() or similar then echo your sql statement to the screen, copy it, paste it into PhpMyAdmin and make sure it is valid - this is usually the problem when I see that error. Something somewhere is not adding the expected variable into your sql statement.
temporarily open up:
e:\vhosts\...\files\getTableContents.php





If there is any difference between the database on the remote and the one on your local machine, it could be causing the query to fail. A common problem I see with scripts using MySQL is that proper checking isn't done from end to end, to ensure that everything worked. All of the MySQL functions return a value that evaluates to false if there is a problem. From the time you connect till the time that the connection is closed, there are any number of things that can go wrong.
You would never get that error if you had evaluated what mysql_query returned first before trying to get a result set, that doesn't exist.
Bookmarks