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 :-) Quote 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) Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/232658-date-intervals/#findComment-1196677 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.