rowCount()函数总是返回0

时间:2018-03-05 16:06:34

标签: php

public function login($email,$password){
    $stmt=$this->pdo->prepare("SELECT 'user_id' from 'users' WHERE 'email'= :email  AND 'password'=:password");
    $stmt->bindParam(":email",  $email, PDO::PARAM_STR);
    $stmt->bindParam(":password",  md5($password) , PDO::PARAM_STR);
    $stmt->execute();

    $user=$stmt->fetch(PDO::FETCH_OBJ);
    $count=$stmt->rowCount();

    if($count > 0){
        $_SESSION['user_id'] = $user->user_id;
        header('Location: home.php');

    }else{
        return false;
    }

即使我的数据库有enteries,count变量在php中的回显中总是显示0,所以即使输入正确的用户名和密码后我也不会忘记home.php页面。可能是什么问题?

0 个答案:

没有答案