MySQL 和 PHP 的 SQL 语法错误。 '来自 poll_maker_options 的选项,其中 poll_id = 3'
我有这个查询:
SELECT votes, option
FROM poll_maker_options
WHERE poll_id = " . $row['poll_id']
我认为没有任何问题,但出现错误:
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行“option FROM poll_maker_options WHERE poll_id = 3”附近使用的正确语法
感谢您的帮助。我希望我不会像昨天一样盲目,当时我无法发现打字错误。
I have this query:
SELECT votes, option
FROM poll_maker_options
WHERE poll_id = " . $row['poll_id']
I see nothing wrong with that but I get the error:
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 'option FROM poll_maker_options WHERE poll_id = 3' at line 1
Thank you for any help. I hope I'm not blind like yesterday when I couldn't spot a typo.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“option”是MySQL中的保留字,所以更改字段名称,或者在使用它的所有查询中用反引号将其括起来:
"option" is a reserved word in MySQL, so either change the field name, or surround it with backticks in all the queries it's used in: