using php, i have a sql query which works fine, dateentry only has the date such as 2012-03-20
"SELECT dateentry FROM mytable WHERE dateentry >= DATE(CURDATE()) ORDER BY navDisplayNum ASC;" enter code here
but i wish to add time to my query so that the dB entry + 8 am is compared to the current date + time
can anyone lend a hand how to properly handle this problem please
"SELECT dateentry FROM mytable WHERE dateentry"." 8:00:00"." >= DATE(NOW()) ORDER BY navDisplayNum ASC;"
this attempt produces an error
“You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘8:00:00 >= DATE(NOW()) ORDER BY navDisplayNum ASC'”
In order to add time to an existing date, use the DATE_ADD function. Just putting a time next to an existing date will not work.
Take a look: