简体   繁体   English

mysqli查询错误,不确定是什么错误

[英]mysqli query error, not sure what's wrong

I have a query here and not sure why the insert is failing... Here is the query and the error 我在这里有一个查询,不确定为什么插入失败...这是查询和错误

INSERT INTO `tokyoStats` (stockName, open, high, low, close, change, stockFrom, stockParent, timestamp) VALUES ('topix', '1190.55', '1192.35', '1181.56', '1181.64', '-3.64', 'japan','topix','2013-09-18T01:00:05+09:00')

You have an error in your SQL syntax; 您的SQL语法有误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'change, stockFrom, stockParent, timestamp) VALUES ('topix', '1190.55', '1192.35'' at line 1 检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在第1行的'change,stockFrom,stockParent,timestamp'附近使用VALUES('topix','1190.55','1192.35'

I'm not sure why this is wrong. 我不确定为什么这是错误的。 I have other queries before this one that work perfectly fine. 在此之前,我还有其他问题可以很好地解决。

change is reserved word for mysql enclose it with backticks (`) and avoid this by changing column names, see this link for reference: http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html change是mysql的保留字,并用反引号(`)括起来,并通过更改列名来避免这种情况,请参阅以下链接以供参考: http : //dev.mysql.com/doc/refman/5.5/en/reserved-words.html

INSERT INTO `tokyoStats` (`stockName`, `open`, `high`, `low`, `close`, `change`, `stockFrom`, `stockParent`, `timestamp`) 
VALUES 
('topix', '1190.55', '1192.35', '1181.56', '1181.64', '-3.64', 'japan','topix','2013-09-18T01:00:05+09:00')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM