Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我的PDO fetch列函数中存在错误_Php_Oop_Pdo - Fatal编程技术网

Php 我的PDO fetch列函数中存在错误

Php 我的PDO fetch列函数中存在错误,php,oop,pdo,Php,Oop,Pdo,我使用PDO对象在php中执行查询 $stmt = $this->db->prepare('select email from users where email = :email'); return (bool) $stmt->execute(array(':email' => $email))->fetchColumn(); 我这里有个错误 致命错误:对非对象调用成员函数fetchColumn() 有什么问题请帮助,$this->db->query()命令正在

我使用PDO对象在php中执行查询

$stmt = $this->db->prepare('select email from users where email = :email');
return (bool) $stmt->execute(array(':email' => $email))->fetchColumn();
我这里有个错误

致命错误:对非对象调用成员函数fetchColumn()

有什么问题请帮助,
$this->db->query()
命令正在运行

谢谢

首先,它的拼写是“execute”,而不是“execute”


其次,
PDOStatement::execute
返回一个布尔值,指示查询是否成功。若要获取结果,必须对原始语句实例调用fetch方法。

您的拼写execute错误。

您好,如果我添加了FETCHTCOLUMN(),那么它会给我错误,请检查-execute返回bool。如果您想访问结果,您应该在新行中键入:
return$stmt->fetchColumn()
hi如果我添加了fetchColumn(),那么它会给出问题中的错误,请检查