JSHINER Posted March 26, 2007 Share Posted March 26, 2007 I have records that are dated using date('y,m,d') when they are created. Would like to only display records that are less than 30 days old. So, IF record is older than 30 days - do not display. Here is my code: $arr = $db->getArray("SELECT * FROM table WHERE id = '$id' ORDER BY date ASC"); Link to comment https://forums.phpfreaks.com/topic/44286-displaying-records-that-are-less-than-30-days-old/ Share on other sites More sharing options...
jitesh Posted March 26, 2007 Share Posted March 26, 2007 SELECT * FROM `tablename` WHERE (TO_DAYS(CURDATE()) - TO_DAYS(the feilds of ur table) <= 30) Link to comment https://forums.phpfreaks.com/topic/44286-displaying-records-that-are-less-than-30-days-old/#findComment-215155 Share on other sites More sharing options...
JSHINER Posted March 26, 2007 Author Share Posted March 26, 2007 Thanks ! Link to comment https://forums.phpfreaks.com/topic/44286-displaying-records-that-are-less-than-30-days-old/#findComment-215367 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.