cmaclennan Posted May 15, 2009 Share Posted May 15, 2009 Hi Guys, I have a form that displays a list of database entries and I am getting the following error:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\show_rma.php on line 23 here is the code: // Count the number of records $query = "SELECT COUNT(*) FROM rma ORDER BY date ASC"; $result = mysql_query ($query); $row = mysql_fetch_array ($result, MYSQL_NUM); $num_records = $row[0]; Thanks Quote Link to comment https://forums.phpfreaks.com/topic/158292-solved-erro-with-mysql_fetch_array/ Share on other sites More sharing options...
Maq Posted May 15, 2009 Share Posted May 15, 2009 Even though your SQL syntax is correct, change your query to: $result = mysql_query($query) or die(mysql_error()); It should display any errors. You can also echo out your $query to see what exactly you're passing through. Quote Link to comment https://forums.phpfreaks.com/topic/158292-solved-erro-with-mysql_fetch_array/#findComment-834882 Share on other sites More sharing options...
cmaclennan Posted May 15, 2009 Author Share Posted May 15, 2009 Thanks that did the trick I found my problem. Much Appreciated as always Quote Link to comment https://forums.phpfreaks.com/topic/158292-solved-erro-with-mysql_fetch_array/#findComment-834885 Share on other sites More sharing options...
Maq Posted May 15, 2009 Share Posted May 15, 2009 Thanks that did the trick I found my problem. Much Appreciated as always Sure np, do you mind sharing what it was? Please mark topic solved, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/158292-solved-erro-with-mysql_fetch_array/#findComment-834886 Share on other sites More sharing options...
cmaclennan Posted May 15, 2009 Author Share Posted May 15, 2009 It was my own fault i had mistyped the table name. Quote Link to comment https://forums.phpfreaks.com/topic/158292-solved-erro-with-mysql_fetch_array/#findComment-834896 Share on other sites More sharing options...
Maq Posted May 15, 2009 Share Posted May 15, 2009 It was my own fault i had mistyped the table name. Doh! That's what I was thinking because your syntax was correct. Quote Link to comment https://forums.phpfreaks.com/topic/158292-solved-erro-with-mysql_fetch_array/#findComment-834899 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.