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. Link to comment https://forums.phpfreaks.com/topic/157848-error-in-script/ 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? Link to comment https://forums.phpfreaks.com/topic/157848-error-in-script/#findComment-832589 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. Link to comment https://forums.phpfreaks.com/topic/157848-error-in-script/#findComment-832592 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.