An employee
An employee

Reputation: 6298

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''

Upvotes: 0

Views: 57

Answers (1)

Zed
Zed

Reputation: 57648

You need to specify the table where you select from. E.g.

SELECT COUNT(user) FROM my_table WHERE ...

Upvotes: 4

Related Questions