Jump to content

PHP error log question


oskom

Recommended Posts

Hello all,

I've got a recurring error in the log that reads "supplied argument is not a valid MySQL result resource in /usr/local/ftp/path/to/file/page.php on line 56". This error occurs on various pages and always in reference to iterations of...

while($row = mysql_fetch_array($result))

 

or...

 

$row = mysql_fetch_array($result)

I always get results from the mysql queries in question so why would this be an error?

 

Link to comment
https://forums.phpfreaks.com/topic/80034-php-error-log-question/
Share on other sites

The error is saying that the table you selected, or even coloumn within the table is invalid. Check all your database information and tables..

 

$result = mysql_query("SELECT * FROM calendars WHERE calendarID = ".$_REQUEST['calendarID']);

 

to

 

$result = mysql_query("SELECT * FROM calendars WHERE calendarID = ".$_REQUEST['calendarID']."");

 

The error means that your mysql_query() function calls are failing and returned a FALSE value instead of a result resource.

 

For each query, you will need to find out why it failed. If this is occurring randomly, then it would either mean that the mysql server is experiencing problems or that you are not validating and checking your data that is being put into the query.

 

It also means that your code is not checking if the mysql_query() failed and blindly continues executing instead of outputting a meaningful error message and stopping.

Responding to revraz...I've always done that only because those ID's are just integers and not text strings. In looking at the other pages with errors, that does seem to be the common thread.

 

PFMaBiSmAd, would revraz's observation about the end quotes in the query result in any of what you mentioned?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.