Jump to content

Error in script


cmaclennan

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.