php中的此mysql查询有什么问题?

时间:2019-07-10 08:09:15

标签: php mysql database

我有问题,但是我不知道哪里出了错?

private function getUsersPasswordByEmail($email){

        $stmt = $this->con->prepare("SELECT 'password' FROM 'user' WHERE 'email' = ?");
        $stmt->bind_param("s", $email);
        $stmt->execute();
        $stmt->bind_result($password);
        $stmt->fetch();
        return $password;}

此行中有错误-

$stmt->bind_param("s", $email);

详细信息 类型:错误 消息:在布尔上调用成员函数bind_param() 文件:C:\ xampp \ htdocs \ MyApi \ includes \ DbOperations.php 行:63

1 个答案:

答案 0 :(得分:0)

尝试使用`反引号代替'单引号

$stmt = $this->con->prepare("SELECT `password` FROM `user` WHERE `email` = ?");
$stmt->bind_param("s", $email);