acidglitter Posted November 19, 2006 Share Posted November 19, 2006 So I have this code that I got off from a website...[code]$tomorrow = mktime(0,0,0,date("m"),date("d")-3,date("Y"));echo "3 days ago.. ".date("F d, Y", $tomorrow);[/code]I just changed it so it shows a date from 3 days ago.. So.. I'm wondering, how could I show all the rows in a table with a date from 3 or more days ago? Quote Link to comment Share on other sites More sharing options...
bqallover Posted November 19, 2006 Share Posted November 19, 2006 Something like this maybe? It assumes the field 'date' is a DATETIME. If it's a unix timestamp, then remove the FROM_UNIXTIME function. Just run the query as you would any other. It's not tested but it should work.[code]$three_days_ago = mktime(0,0,0,date("m"),date("d")-3,date("Y"));$sql = "SELECT * FROM table WHERE date <= FROM_UNIXTIME($three_days_ago)";[/code] Quote Link to comment Share on other sites More sharing options...
acidglitter Posted November 20, 2006 Author Share Posted November 20, 2006 That works gorgeously. 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.