我在这里有一个查询,但不确定插入失败的原因...这是查询和错误
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; 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
我不确定为什么这是错误的。在这个问题之前,我还有其他问题可以正常工作。
最佳答案
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')
关于php - mysqli查询错误,不知道哪里出了问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18854868/