oskom Posted December 3, 2007 Share Posted December 3, 2007 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? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 3, 2007 Share Posted December 3, 2007 What does your query look like Quote Link to comment Share on other sites More sharing options...
oskom Posted December 3, 2007 Author Share Posted December 3, 2007 There are various queries, but here's an example that keeps coming up... $result = mysql_query("SELECT * FROM calendars WHERE calendarID = ".$_REQUEST['calendarID']); while($row = mysql_fetch_array($result)) { //LOOP THROUGH DATA } Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 3, 2007 Share Posted December 3, 2007 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'].""); Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 3, 2007 Share Posted December 3, 2007 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. Quote Link to comment Share on other sites More sharing options...
oskom Posted December 3, 2007 Author Share Posted December 3, 2007 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.