How to find rowCount in pdo prepare in php


I am learning PDO prepare statement in php.

I have some error.

public function check_user_validation($user_email,$user_password)
    $salt1 = "5g;;";
    $salt2 = "466UU$%jjh";
    $user_password = hash("sha512",$salt1.$user_password.$salt2);
    $result = $this->con->prepare("select id from user_table where user_email=:user_email&& user_password=:user_password");
        ':user_email' => '$user_email',
        ':user_password' => '$user_password',       
    $result = $result->rowCount();
    if($result > 0)
        $_SESSION['user_email'] = $user_email;
        return FALSE;

BUt it returns false. Id and password bot are true. I thinkrowCount() giving it0 value.




    ':user_email' => $user_email,
    ':user_password' => $user_password,       

You need to remove single quote in order to pass variables, $user_email and $user_password.

People are also looking for solutions to the problem: php - Laravel Enable to Download Export Project Zip file to Browser


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.