refiking Posted June 9, 2007 Share Posted June 9, 2007 I am trying to count the number of records in a table called records. Here is the error message: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/ctpwebco/public_html/leads/proc.php on line 271 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/ctpwebco/public_html/leads/proc.php on line 272 Here are lines 271 and 272 $daily = mysql_num_rows($dql); $weekly = mysql_num_rows($dql); Here is the code of what I am trying to accomplish $date = date("Y:m:d"); $dql = mysql_query("SELECT record_id FROM Records WHERE record_date = '$date'"); $daily = mysql_num_rows($dql); $weekly = mysql_num_rows($dql); Can anyone tell me how to retrieve the records for an entire week. Say from Monday to Monday for example. Link to comment https://forums.phpfreaks.com/topic/54881-solved-mysql_num_rows-not-valid-resource/ Share on other sites More sharing options...
B34ST Posted June 9, 2007 Share Posted June 9, 2007 When I have had this error in the past it has been due to a silly mistake. check that you have spelt the table names and rows correct and that $date is the same format as the date in your db. Link to comment https://forums.phpfreaks.com/topic/54881-solved-mysql_num_rows-not-valid-resource/#findComment-271418 Share on other sites More sharing options...
chocopi Posted June 9, 2007 Share Posted June 9, 2007 Looking at your code i cant see what the problem is, sorry To select between weeks i think you do something like this: $dql = mysql_query("SELECT record_id FROM Records WHERE record_date = '$date1 <= $date <= $date2'"); Thats just a guess, but i hope it helps, ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/54881-solved-mysql_num_rows-not-valid-resource/#findComment-271420 Share on other sites More sharing options...
chigley Posted June 9, 2007 Share Posted June 9, 2007 $dql = mysql_query("SELECT record_id FROM Records WHERE record_date = '$date'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/54881-solved-mysql_num_rows-not-valid-resource/#findComment-271464 Share on other sites More sharing options...
refiking Posted June 9, 2007 Author Share Posted June 9, 2007 It wasn't record_date. It was date_record. :'( Link to comment https://forums.phpfreaks.com/topic/54881-solved-mysql_num_rows-not-valid-resource/#findComment-271476 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.