dadamssg Posted May 26, 2009 Share Posted May 26, 2009 i have events stored in my db with start and end dates...im trying to pull up all events that haven't ended so heres my query SELECT * FROM `test` WHERE DATE(end) > NOW() 'end' is a datetime field the above will not pull up this event however with these datetime start end 2009-05-26 01:10:00 2009-05-26 18:20:00 what in the world? Quote Link to comment https://forums.phpfreaks.com/topic/159665-help-with-a-simple-queryso-confused/ Share on other sites More sharing options...
GingerRobot Posted May 26, 2009 Share Posted May 26, 2009 The DATE function just extracts the date part of the timestamp. Hence you're checking if 2009-05-26 > 2009-05-26, which it's obviously not. Quote Link to comment https://forums.phpfreaks.com/topic/159665-help-with-a-simple-queryso-confused/#findComment-842133 Share on other sites More sharing options...
Ken2k7 Posted May 26, 2009 Share Posted May 26, 2009 All you have to do is take out the DATE() function. Can't be too hard. Quote Link to comment https://forums.phpfreaks.com/topic/159665-help-with-a-simple-queryso-confused/#findComment-842303 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.