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 'key = '48f9f4a3f5e10c63804400f320f46e26'' at line 1

所以我在网页上反映回来,它写着:

SELECT * FROM email_confirm WHERE email = 'censored@gmail.com' AND key = '48f9f4a3f5e10c63804400f320f46e26'

我没有看到这个问题.

MySQL版本是5.1.65-cll

回答:
    KEY是mysql中的保留字.需要反击!

解决方法:

key是一个MySQL关键字.由于它也是您的字段的名称,请用适当的符号括起来:

SELECT * FROM `email_confirm` WHERE `email` = 'censored@gmail.com' AND `key` = '48f9f4a3f5e10c63804400f320f46e26';
上一篇:为什么Javascript的OR返回的值不是true / false?


下一篇:javascript – 循环 – forEach,for … for … for,for … in