Web Hosting Talk







View Full Version : Warning: mysql_fetch_array(): 8


ceetee
09-03-2004, 07:29 AM
Warning: mysql_fetch_array(): 8 is not a valid MySQL result resource.

The sql which this warning relates too has been checked as valid by testing it directly with mySql and apart from generating an warning runs correctly. And the script runs without warnings in another host's server, both version 4.3.8. So I'm guessing this is some setup error by the host.

So the question is what does 8 refer too? Or has anybody else experienced this seemingly erroneous warning from mysql_fetch_array()

probonic
09-03-2004, 07:44 AM
It looks like the "8" is the value that had actually been returned by the mysql_query command. mysql_query is supposed to return either the resource identifier ("8" is of course not a valid one), or FALSE if it fails.

So it is very strange that it works on one server but not another.

Maybe you could post a snippet of the code?

armstrongecom
09-03-2004, 09:35 AM
Phil is correct that the "8" refers to the resource identifier of the result set.

If I recall correctly, resource identifiers always begin with 1 each time a php page executes, so to debug you'd look for the eighth execution of a resource on your page (including any include or require files your page calls). Somewhere later on that page, you have a mysql_fetch_array() function calling a result set with that identifier, and the result set isn't there because of a possible error in your sql statement, or some other reason.

My guess why the script works on one server and not another is that it really fails on both, but one of the servers is set not to show warning messages, so you're not seeing it. You mentioned the page seems to be working despite the warning anyway.

-A