cmaclennan Posted May 12, 2009 Share Posted May 12, 2009 Hi Guys, Hoping someone can shed some light on this for me I have a page to search for open tickets in a database but I get the warning when i load the page: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\open_search.php on line 25 here is the portion of code I am working with around line 25. // Count the number of records $query = "SELECT COUNT(*) FROM tickets WHERE status='Open' ORDER BY category ASC"; $result = @mysql_query ($query); $row = mysql_fetch_array ($result, MYSQL_NUM); $num_records = $row[0]; Thanks in advance for your help. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Something's wrong with the query. Use this - // Count the number of records $query = "SELECT COUNT(*) FROM tickets WHERE status='Open' ORDER BY category ASC"; $result = mysql_query ($query) or die(mysql_error()); $row = mysql_fetch_array ($result, MYSQL_NUM); $num_records = $row[0]; Any errors from that? Quote Link to comment Share on other sites More sharing options...
cmaclennan Posted May 12, 2009 Author Share Posted May 12, 2009 Thanks that worked, much appreciated as always. 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.