Reputation: 5302
Is this the proper way to display all rows who have dates today.
I'm using time() to store dates in mysql, time() is a php function.
I'm getting this syntax 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 '1 DAY)))' at line 1
SELECT COUNT( * ) AS today
FROM `myTable`
WHERE `date`
BETWEEN UNIX_TIMESTAMP( DATE( NOW( ) ) )
AND UNIX_TIMESTAMP( DATE( DATE_ADD( NOW( ) , 1
DAY ) ) )
What the problem of these? Your help would be greatly apprciated.
Thanks!
Upvotes: 0
Views: 58
Reputation: 88378
The keyword INTERVAL
is missing. Try
DATE_ADD( NOW(), INTERVAL 1 DAY)
Examples here: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
Upvotes: 1