简单的mysql选择错误限制

mis*_*cus 0 php mysql sql

这是错误消息和我的代码.我只是没有看到错误.

描述:

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='cbd1f3bb822e8617b624301774287490d3fcd97e' LIMIT 1' at line 1

查询:

SELECT * 
FROM wp_wpsc_api_keys 
WHERE name='MichelleAllen17' 
AND key='cbd1f3bb822e8617b624301774287490d3fcd97e' 
LIMIT 1
Run Code Online (Sandbox Code Playgroud)

欢迎任何关于我的SQL中可能出现问题的想法

Joh*_*Woo 8

KEY 是保留关键字,必须使用反引号进行转义.

SELECT  * 
FROM    wp_wpsc_api_keys 
WHERE   name = 'MichelleAllen17' AND 
        `key` = 'cbd1f3bb822e8617b624301774287490d3fcd97e' 
LIMIT   1
Run Code Online (Sandbox Code Playgroud)