问题
So... I received:
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
and so I reflected it back to myself, on the webpage and it reads:
SELECT * FROM email_confirm WHERE email = 'censored@gmail.com' AND key = '48f9f4a3f5e10c63804400f320f46e26'
I don't see the issue.
MySQL version is 5.1.65-cll
Answer:
KEY is a reserved word in mysql. Need backticks
!
回答1:
key
is a MySQL keyword. Since it's also the name of your field, enclose it with the appropriate symbols:
SELECT * FROM `email_confirm` WHERE `email` = 'censored@gmail.com' AND `key` = '48f9f4a3f5e10c63804400f320f46e26';
回答2:
Key is a reserved word. Use backticks to escape it.
... `key` = '48f9...'
回答3:
I think key is a reserved word. Use `key` instead.
来源:https://stackoverflow.com/questions/13829809/mysql-syntax-seems-correct