Click to See Complete Forum and Search --> : [RESOLVED] SQL Update Question


prophet1024
04-04-2009, 10:38 PM
Been fiddling with this for 45min and can't see my bug.

UPDATE TimeClock SET Out='2009-04-04 21-32-24' WHERE UserId='4' AND TimeId='3'
I get this 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 'Out='2009-04-04 21-32-24' WHERE UserId='4' AND TimeId='3'' at line 1

Any ideas? It doesn't work via PHP or the SQL editor in PHPMyAdmin. The "Out" column is set to DATETIME.

NogDog
04-04-2009, 11:17 PM
"Out" is a MySQL reserved word (http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html). Try quoting it (with `back-quotes`).

prophet1024
04-04-2009, 11:58 PM
Thanks, that fixed it!