Php 绑定参数时发生SQLState错误

Php 绑定参数时发生SQLState错误,php,mysql,Php,Mysql,今天我在尝试进行一些查询时得到了一个不寻常的响应,下面是错误输出 [17-Feb-2014 12:37:24 America/Denver] PHP Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MyS

今天我在尝试进行一些查询时得到了一个不寻常的响应,下面是错误输出

[17-Feb-2014 12:37:24 America/Denver] PHP Warning:  PDOStatement::execute():
SQLSTATE[42000]: Syntax error or access violation: 1064 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 = 'AH3D'' at line 1 in file on line 28
这是我使用的代码,我一直都是这样做的

public function get($key = null) {
    $get = $this->conn->prepare("SELECT url FROM urls WHERE key = :get");
    $get->execute(array(':get' => $key));
    return $get->fetch();
}
如何调用函数

echo $tiny->get($_GET['key']);

Key是一个mysql保留关键字,您需要在列名
Key

$get = $this->conn->prepare("SELECT url FROM urls WHERE `key` = :get");

非常感谢,我过去常常把虱子放回去,但后来就停了,因为我觉得它们什么也没做。我必须重新开始,并仔细阅读关键术语。一个好的做法是使用反勾号,这样可以为此类错误节省时间,而且如果你觉得这个答案很有帮助,那么请阅读@downvorters,至少表现出一些尊重,并就如何使答案更准确提供反馈