I am creating a login for for my website and have hit a roadblock. Every time I run my PHP script to check if their password matches the one in the database for the email that they have entered, it returns that it hasn't. To check the issue, I made the page print the values being entered (username and password), and the real password value. The real password had done nothing but returned itself as blank. The following is the code I am using.
$loginEmail = $_POST['loginemail'];
$loginPassword = $_POST['loginpassword'];
$query = "SELECT password FROM user_information WHERE email = '$loginEmail'";
$realLoginPassword = mysql_query($query);
if($loginPassword == $realLoginPassword){
echo 'Success in login with ' . $loginEmail . '! Password: ' . $realLoginPassword . '! You have entered: ' . $loginPassword . '!';
}else{
echo 'Your email at ' . $loginEmail . ' or password is incorrect!';
echo '<br>';
echo "You've entered: " . $loginPassword . " and the real one is: " . $realLoginPassword . "!";
}
I have also tried:
$realLoginPassword = "SELECT password FROM user_information WHERE email = '$loginEmail'";
But it didn't work either and I had the same issue.
Am I using the wrong method, keying in my script wrong, or something else? Any feedback is appreciated!