View Full Version : Resolved Fetch Array not working

12-02-2008, 10:40 PM
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/jsfdan/public_html/forum.php on line 133

Err, why has that happened. Line 134 code looks fine to me.

Line 134:

$newest = mysql_fetch_array(mysql_query("SELECT * FROM `forum_thread` WHERE `cat_id` = '$topic[id]' ORDER BY `datetwo` DESC LIMIT 0, 1"));

Funny thing is, this worked when I was on my old host.

12-02-2008, 10:44 PM
Add error checking.

12-02-2008, 11:24 PM
I'll expand on what Fumigator posted.

Your code has no application error checking, error reporting (logging), and error recovery logic in it to test if the query worked or not, report (or log) why it did not work, and take appropriate action when it does not work (like don't execute a mysql_fetch_xxxxx() instruction after a query that failed.) So, of the dozen possible reasons why it is not working, we cannot tell you which one, but your program could with some application error checking, error reporting, and error recovery logic.

12-02-2008, 11:26 PM
Ah thank you.