我有以下查询:
INSERT INTO user ('username', 'password', 'email', number)
VALUES ('user123', '123', 'email123@hotmail.com', 2)
我得到了错误:
#1064 - 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 ''username', 'password', 'email', space) VALUES('user123', '123', 'email123@hotmail.com', 2)
还有一个自增字段(mediumint),显然在sql语句中没有提到。可以吗?
请帮我解决这个问题。
最佳答案
使用反引号(在“1”键的左侧)而不是那里的引号:
INSERT INTO user (`username`, `password`, `email`, `number`)
VALUES ('user123', '123', 'email123@hotmail.com', 2)
关于php - mysql基本插入语句错误1064,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27846635/