jeff5656 Posted February 27, 2013 Share Posted February 27, 2013 I am trying to select records where the date is 35 days from now or less (i.e less than 35 days from now includes all dates that have passed as well). However, when I do the code below, $query = "select * from institutions where exp_date < date_sub(now(), interval 35 day) order by name"; all I get are expired records. I have a record where the exp_date is 3/23/13 but it is not getting selected. Note: the exp_date is a DATE field. Link to comment https://forums.phpfreaks.com/topic/275031-select-based-on-a-date-35-days-in-the-future/ Share on other sites More sharing options...
Barand Posted February 27, 2013 Share Posted February 27, 2013 ...WHERE exp_date < CURDATE() + INTERVAL 35 DAY Link to comment https://forums.phpfreaks.com/topic/275031-select-based-on-a-date-35-days-in-the-future/#findComment-1415473 Share on other sites More sharing options...
jeff5656 Posted February 27, 2013 Author Share Posted February 27, 2013 Perfect. Thank you! Link to comment https://forums.phpfreaks.com/topic/275031-select-based-on-a-date-35-days-in-the-future/#findComment-1415484 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.