准备语句时出现此错误:调用未定义的方法mysqli_stmt :: get_result()

时间:2018-01-24 18:27:23

标签: php mysql

我的代码在第5行返回错误:

  

致命错误:调用未定义的方法mysqli_stmt :: get_result()

$email = $_POST['email'];
$stmt = $con->prepare("SELECT password FROM users WHERE email=?");
$stmt->bind_param("s", $email);
$stmt->execute();
$result = $stmt->get_result();
$num_of_rows = $stmt->num_rows;

if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $password = $row['password'];
        $verify = password_verify($_POST['password'], $password);
        if ($verify) {
            echo "success";
        }
        else {
            echo "not success";
        }
    }
}

else {
    echo "incorrect username or password";
}

我正在运行PHP 5.6并启用了mysqlnd。

0 个答案:

没有答案