我使用了函数,它运行良好,但对于$ userRow = $ stmt-> fetch(PDO :: FETCH_ASSOC);没有工作

时间:2017-12-05 07:36:09

标签: mysql pdo

美好的一天,请帮我解决($userRow=$stmt->fetch(PDO::FETCH_ASSOC);

的问题
public function doLogin($uname,$umail,$upass)
{
    try
    {
        $stmt = $this->conn->prepare("SELECT acctID, username, email, password FROM tbl_user WHERE username=:uname OR email=:umail ");
        $stmt->execute(array(':uname'=>$uname, ':umail'=>$umail));
        $userRow=$stmt->fetch(PDO::FETCH_ASSOC);
        if($stmt->rowCount() == 0)
        {
            if(password_verify($upass, $userRow['password']))
            {
                $_SESSION['user_session'] = $userRow['acctID'];
                return true;
            }
            else
            {
                return false;
            }
        }
    }
    catch(PDOException $e)
    {
        echo $e->getMessage();
    }
}

0 个答案:

没有答案