shotos Posted August 25, 2008 Share Posted August 25, 2008 Hi i have a table with several columns of which one is of type datetime. i want to output rows with a specific date say 24-08-2008. but i keep getting this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/kwasi/public_html/call.php on line 151 this is my code $query = "select * from Element_$header where year(date_field)='$year' and month(date_field)='$month' and day(day_field)='$day'"; $result = mysql_query($query,$db->link); if(mysql_num_rows($result)) Link to comment https://forums.phpfreaks.com/topic/121212-solved-mysql-datetime-query/ Share on other sites More sharing options...
Mchl Posted August 25, 2008 Share Posted August 25, 2008 Apparently your query didn't succeed. Use: if(!$result = mysql_query($query,$db->link)) { echo mysql_error(); } to echo error information Link to comment https://forums.phpfreaks.com/topic/121212-solved-mysql-datetime-query/#findComment-624839 Share on other sites More sharing options...
shotos Posted August 25, 2008 Author Share Posted August 25, 2008 i got it now. it was a mistake in the column name tanx Link to comment https://forums.phpfreaks.com/topic/121212-solved-mysql-datetime-query/#findComment-624847 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.