Page 1 of 1

date query returning incorrectly

Posted: Fri Feb 02, 2007 3:53 pm
by Obadiah
im running this query

Code: Select all

$sql="SELECT * FROM merchant WHERE user_name = '{$_SESSION['logname']}' AND create_date<=DATE_SUB(CURDATE(), INTERVAL 30 DAY) order by date_recieved";
and for some reason its returning values from december....what would be the reason for this?

Posted: Fri Feb 02, 2007 4:46 pm
by superdezign
Not sure. Maybe you could try searching the database using date() and mktime()...

Posted: Fri Feb 02, 2007 5:06 pm
by mikeq
december is before the 3 January, you are asking to return records less than or equal to 3 January.