refiking Posted July 19, 2009 Share Posted July 19, 2009 I want to search for records with a timestamp of X number of days old. The vairable for the age is $seasoned. $season_query = mysql_query("select `hobbie_name` from `weirdos` where `stamp` \\is $seasoned number of days old or more Quote Link to comment https://forums.phpfreaks.com/topic/166539-solved-set-sql-query-for-certain-number-of-days/ Share on other sites More sharing options...
.josh Posted July 19, 2009 Share Posted July 19, 2009 are you saying that $seasoned is for instance 28 as in 28 days old? $seasoned = time() - $seasoned * 60 * 60 * 24; ...where `stamp` < $seasoned Quote Link to comment https://forums.phpfreaks.com/topic/166539-solved-set-sql-query-for-certain-number-of-days/#findComment-878242 Share on other sites More sharing options...
refiking Posted July 19, 2009 Author Share Posted July 19, 2009 didn't work. Does it have to be reformatted to the timestamp format to make that work? And if so, how can I convert $seasoned into the timestamp format prior to running it in the query? Quote Link to comment https://forums.phpfreaks.com/topic/166539-solved-set-sql-query-for-certain-number-of-days/#findComment-878247 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.