Problems with if help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
reddurango
Forum Newbie
Posts: 13
Joined: Sun Aug 16, 2009 9:17 am

Problems with if help

Post by reddurango »

Hello i have a problem with this if, i'm trying to make it work but the else sentence doesn't work, when the condition is true it works but when its false it doesn't 'cause it doesn't show anything it leaves the page blank. Please help.

Code: Select all

$user = $_POST ["usuario"];
$pass = $_POST ["password"];
 
$result = mysql_query("SELECT * FROM clientes
WHERE clientes_correo='{$user}';");
 
while ($row = mysql_fetch_array($result))
{
if ($pass==$row['clientes_password'])
    {
    echo "Tus datos son correctos da click para continuar <br/>";
    $_SESSION['usuario']=$user;
    $_SESSION['nombre']=$row['clientes_nombre'];
    echo "<a href=index.php>Continuar";
    }
    elseif ($pass!=$row['clientes_password'])
        {
    echo "Tus datos son incorrectos da click para continuar";
    echo "<a href=index.php>Continuar";
}
    else
    echo "Error: Intente Nuevamente";
}
?>
User avatar
highjo
Forum Contributor
Posts: 118
Joined: Tue Oct 24, 2006 1:07 pm

Re: Problems with if help

Post by highjo »

hello how do you know the $pass has the value you are checking for?one step to find out what is happening is to print the value of $pass and each value of $row['clientes_password']; hope this helps you find out what is wrong
Post Reply