Here is some code (snippet) from a function I have that takes a users "user_name" and "password" as parameters.
There is an if else statement that triggers along the way, basically, if there is a value $v, then it look ups the users user_name and password in a table and appends the @gmail part to it (so that the input username matches the email in the database) and if they are equal, it will log them in, otherwise it will display a message stating that there was an error while logging in.
The trouble is, I can't get the error message (the second if) to occur, even though the login sections are working fine.
Can anyone spot something obvious in the statment that would cause the error to never show up when a wrong username and password is input?
Thanks in advance.
stuff comes before this...
if ( $v )
{
$email = $user_name . "@gmail.com";
$query = "SELECT id, email FROM auth WHERE email = '".$email."'";
$result = mydb::cxn()->query($query);
$row = $result->fetch_assoc();
$user_name = $user_name . "@gmail.com";
if($row['email'] != $user_name)
{
echo '<p style="color: red;">There was an error logging in</p>';
}
else {
login stuff...
}