Thursday, April 28, 2011

mysql error when comparing date (php)

I am not sure why this i get this mysql error. Originally i didnt have '' around the date. Then i tried ''' and '`' without any luck. Whats wrong?

SELECT COUNT(user) WHERE user=1 AND pass_time<'2009-09-21 13:44:38';


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 'WHERE user=1 AND pass_time<'2009-09-21 13:44:38''
From stackoverflow
  • You need to specify the table where you select from. E.g.

    SELECT COUNT(user) FROM my_table WHERE ...
    
    An employee : geez, now i am embarrassed.
    Carson Myers : I think I can see you blushing from here

0 comments:

Post a Comment