Hi folks,
I am having serious trouble comparing dates to entries in the database. Here is my following code:
$newdate2 = date(“Y-m-d H:i:s”, mktime(date(“H”), date(“i”), date(“s”), date(“m”), date(“d”)-1, date(“Y”)));
$query = “select count (*) as counter FROM Orders WHERE UNIX_TIMESTAMP(OrderDate) > $newdate2”;
$result = mysql_query($query);
$row = mysql_fetch_array($result);
The page gives me an error around where the date is being compared.
OrderDate is a datetime variable with yyyy-mm-dd hh:mm:ss format.
I have tried the code without the UNIX_TIMESTAMP and it still doesn’t work.
Thanks in advance,
- Michael