jeff5656 Posted April 4, 2011 Share Posted April 4, 2011 I'm stuck on how to only display records if they are in the last 3 days: how do i say: if $row['test_date'] occurred more than 3 days ago: don't display. else, display. Thank you :-) Link to comment https://forums.phpfreaks.com/topic/232658-date-intervals/ Share on other sites More sharing options...
Pikachu2000 Posted April 4, 2011 Share Posted April 4, 2011 If you don't need it, you're better off not to select it to begin with. SELECT `fields` FROM `table` WHERE `test_date` > DATE_SUB(CURDATE(), INTERVAL 3 day) Link to comment https://forums.phpfreaks.com/topic/232658-date-intervals/#findComment-1196668 Share on other sites More sharing options...
jeff5656 Posted April 4, 2011 Author Share Posted April 4, 2011 That's much better - doing in the sql query. Thanks! Link to comment https://forums.phpfreaks.com/topic/232658-date-intervals/#findComment-1196677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.