timmah1 Posted December 17, 2009 Share Posted December 17, 2009 Why does this show "cannot get results!" constantly?? $events = array(); $query = "SELECT title, DATE_FORMAT(event_date'%Y-%c-%e') AS event_date FROM events WHERE event_date LIKE '$year-$month%'"; $result = mysql_query($query,$db) or die('cannot get results!'); while($row = mysql_fetch_assoc()) { $events[$row['event_date']][] = $row; } Thanks in advance Link to comment https://forums.phpfreaks.com/topic/185502-no-results/ Share on other sites More sharing options...
rajivgonsalves Posted December 17, 2009 Share Posted December 17, 2009 if you put the following we will find out $result = mysql_query($query,$db) or die('cannot get results!:'.mysql_error()); Link to comment https://forums.phpfreaks.com/topic/185502-no-results/#findComment-979381 Share on other sites More sharing options...
JAY6390 Posted December 17, 2009 Share Posted December 17, 2009 DATE_FORMAT(event_date'%Y-%c-%e') should be DATE_FORMAT(event_date, '%Y-%c-%e') Link to comment https://forums.phpfreaks.com/topic/185502-no-results/#findComment-979383 Share on other sites More sharing options...
ignace Posted December 17, 2009 Share Posted December 17, 2009 typo: while($row = mysql_fetch_assoc()) should be: while($row = mysql_fetch_assoc($result)) use trigger_error() instead of die() Link to comment https://forums.phpfreaks.com/topic/185502-no-results/#findComment-979384 Share on other sites More sharing options...
timmah1 Posted December 17, 2009 Author Share Posted December 17, 2009 I always seem to forget that rajivgonsalves Thanks jay, that worked. and thank you ignace, I didn't even see that Works now! Link to comment https://forums.phpfreaks.com/topic/185502-no-results/#findComment-979390 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.