我正在编写一些PHP代码,以便在我的MySQL数据库中插入一个值:
INSERT INTO users_validate (uid, key) VALUES ('11', '4866ce5568850eb5f8daad79a8822d26')
有人可以告诉我这有什么问题吗?
编辑:错误消息是
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 'key) VALUES ('11', '4866ce5568850eb5f8daad79a8822d26')' at line 1
答案 0 :(得分:5)
尝试转义列名key
:
INSERT INTO users_validate (uid, `key`) VALUES ('11', '4866ce5568850eb5f8daad79a8822d26')
KEY
是MySQL中的保留字:http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html