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? Link to comment https://forums.phpfreaks.com/topic/27752-resolved-simple-question/ 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] Link to comment https://forums.phpfreaks.com/topic/27752-resolved-simple-question/#findComment-126998 Share on other sites More sharing options...
acidglitter Posted November 20, 2006 Author Share Posted November 20, 2006 That works gorgeously. Thanks! :) Link to comment https://forums.phpfreaks.com/topic/27752-resolved-simple-question/#findComment-127262 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.