I have a datetime var:
string(19) "2012-09-14 00:00:00"
I want to find the 5 rows in the table that are before this datetime.
How could I do this?
$db->query("SELECT id, title FROM news WHERE datetime < " . $db->escape($datetime) . ");
The above does not appear to work.
Im using mySQL.
Enclose by quote datetime value and enclose by backtick datetime column name.