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"); Quote Link to comment 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) Quote Link to comment Share on other sites More sharing options...
JSHINER Posted March 26, 2007 Author Share Posted March 26, 2007 Thanks ! Quote Link to comment 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.