Page 1 of 1

Displaying Results

Posted: Sun May 19, 2002 3:07 pm
by nashyboy
Im having trouble with the following - can anyone help?

each entry in my table has a date entry (the date it was added) - but i cant work out the sql to, for example, pull out all results that have been added in the last 30 days or preferably the last 1 month.

Can anyone help me with this with an example

Cheers :)

Posted: Sun May 19, 2002 4:34 pm
by volka
if it is mysql try

Code: Select all

$today = date('Y-m-d', time());
$mresult = $dbo->query("SELECT * from db where date <="$today" AND date >="$today"+INTERVAL 1 MONTH ORDER BY DATE");
and take a look at mysql date and time functions