date comparison

admin

Administrator
Staff member
Hi,
I need to select rows from a database less than 7 days old.
For the moment, I use :
$query = "SELECT * FROM mytable WHERE date > ".date("Y-m-d", (time()- 604800))."";
But I'm sure there is a smarter way to make this query (using mysql date comparison functions for example), but I can't figure out how....
Could someone help me please?
Thanks in advance,
Emilien Arino
 
Back
Top