Assuning that I have a table with time stamp as one of the filed...
What would be the query to find the rows inserted with in the last 48 hours???
Hope u can help me!!! :wave:
Printable View
Assuning that I have a table with time stamp as one of the filed...
What would be the query to find the rows inserted with in the last 48 hours???
Hope u can help me!!! :wave:
Assuming you're storing it in the database as a UNIX time stamp, this will find the last 48 hours in seconds, followed by a sample query.
PHP Code:<?
$twodays = time() - (3600 * 48) //3600 is the amount of seconds in an hour, multiplied by 48 = 48 hours
$query = "SELECT * FROM tablename WHERE timestamp>=($twodays)";
//do other stuff
?>
Mysql?
From the manual here:
http://dev.mysql.com/doc/refman/5.0/...functions.html
Alter it to use two days:
Good luckPHP Code:SELECT something FROM tbl_name
WHERE DATE_SUB(CURDATE(),INTERVAL 2 DAY) <= date_col;