Exi*_*2r4 2 php mysql database syntax
我在查询的php中遇到mysql查询时遇到问题
INSERT INTO rfqtable (rfqnumber, prnumber, linenumber, shipmentnumber, item, desc, needbydate, uom, rfqqty, quotedqty, unitprice, amountprice, lt, substitute, remark, coc, tds, exportlicense, maker, quotedmaker, substituteinfo, validuntil, warranty, program, packingtype, attachment)VALUES('63915', '86298', '1', '1', '229-027477', 'WASHER, SEALING', 'AUG-26-2011', 'Each', '50', '0', '0', '0', '0', '', '', 'N', 'N', '', '', '', '', '0', '0', 'KFP', '', '')
Run Code Online (Sandbox Code Playgroud)
并且mysql错误是:
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 'desc, needbydate, uom, rfqqty, quotedqty, unitprice, amountprice, lt, substitute' at line 1
Run Code Online (Sandbox Code Playgroud)
它们都是varchar 255字段,utf-8一般
任何帮助将不胜感激
DESC是MySQL的保留字.如果你想将它用作列名,你需要把它放在反引号中(``)
INSERT INTO rfqtable (
rfqnumber, prnumber, linenumber, shipmentnumber, item, `desc`,
needbydate, uom, rfqqty, quotedqty, unitprice, amountprice, lt,
substitute, remark, coc, tds, exportlicense, maker, quotedmaker,
substituteinfo, validuntil, warranty, program, packingtype, attachment
) VALUES (
'63915', '86298', '1', '1', '229-027477', 'WASHER, SEALING',
'AUG-26-2011', 'Each', '50', '0', '0', '0', '0', '', '', 'N',
'N', '', '', '', '', '0', '0', 'KFP', '', '')
Run Code Online (Sandbox Code Playgroud)
另外:请为了您自己,请使用正确的数据类型.将日期和数字存储为VARCHAR可能是您可以做的最糟糕的事情. http://dev.mysql.com/doc/refman/5.5/en/data-types.html