digitalgod Posted July 23, 2008 Share Posted July 23, 2008 hey guys, I'm trying to verify events that will start between curdate() and 31 days later. so far this is my query but it doesn't seem to work SELECT id, main_image FROM events WHERE member_id = '$_SESSION[members_id]' AND DATE_ADD(CURDATE() ,INTERVAL 31 DAY) >= start where start is the date and time of when the event starts. I keep getting events that have already passed with that query and I don't understand why... I just need to select all dates that start between now and 31 days later... any ideas?? Link to comment https://forums.phpfreaks.com/topic/116147-solved-selecting-dates-between-now-and-31-days-later/ Share on other sites More sharing options...
accident Posted July 23, 2008 Share Posted July 23, 2008 you forgot to add in the check for greater then today... so shoudl be SELECT id, main_image FROM events WHERE member_id = '$_SESSION[members_id]' AND DATE_ADD(CURDATE() ,INTERVAL 31 DAY) >= start AND start > CURDATE() Link to comment https://forums.phpfreaks.com/topic/116147-solved-selecting-dates-between-now-and-31-days-later/#findComment-597502 Share on other sites More sharing options...
accident Posted July 23, 2008 Share Posted July 23, 2008 err should be start >= CURDATE() Link to comment https://forums.phpfreaks.com/topic/116147-solved-selecting-dates-between-now-and-31-days-later/#findComment-597503 Share on other sites More sharing options...
digitalgod Posted July 23, 2008 Author Share Posted July 23, 2008 thanks accident, can't believe I didn't see that... note to self, sleep more! Link to comment https://forums.phpfreaks.com/topic/116147-solved-selecting-dates-between-now-and-31-days-later/#findComment-597635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.