gpt4 book ai didi

php - 语法错误问题mysql_query和php

转载 作者:搜寻专家 更新时间:2023-10-30 20:02:52 25 4
gpt4 key购买 nike

我在 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', '', '')

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

都是varchar 255字段,utf-8通用

任何帮助将不胜感激

最佳答案

DESCMySQL's reserved word .如果要将其用作列名,则需要将其放在反引号 (``)

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', '', '')

另外:为了您自己的利益,请使用正确的数据类型。将日期和数字存储为 VARCHAR 可能是您能做的最糟糕的事情。 http://dev.mysql.com/doc/refman/5.5/en/data-types.html

关于php - 语法错误问题mysql_query和php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6933266/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com