"mysql语法错误",没有真正的问题

mho*_*321 2 php mysql mysqli insert syntax-error

我的代码将错误Error in mysql syntax放在我插入数据库的代码行上.当我回应插入时,我得到了

INSERT INTO patches (
 name, 
 description, 
 type, 
 com1, 
 com2, 
 com1,  
 code, 
 db, 
 other, 
 tfsID, 
 release, 
 createdBy, 
 createdDtTm, 
 updatedBy, 
 updatedDtTm
) VALUES (
 'testPatch2',
 'longPatchDescription',
 'Code - Full Build',
 '0',
 '1',
 '1', 
 '0',
 '1',
 '1',
 '98765',
 '6.11.0',
 'mhopkins',
 '2013/06/26 08:58:19',
 'mhopkins', 
 '2013/06/26 08:58:19'
)
Run Code Online (Sandbox Code Playgroud)

我相信我的语法还可以.但我很困惑为什么我无法获得有关错误的更多数据.思考?

确切的错误

Errormessage: 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 'release, createdBy, createdDtTm, updatedBy, updatedDtTm) VALUES ('testPatch2','l' at line 1
Run Code Online (Sandbox Code Playgroud)

Fal*_*len 8

RELEASE是mysql的保留字,不能用作列名或表名不加引号.

这里有MySQL保留字列表:http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html

  • 其实.它可以用作列名,您只需要将其转义即可.但如果可能的话,它就不会被使用. (2认同)