In the following php script when correct un and pass were given, it displays Welcome.But when we give wrong pass as shown in the code, it doesn't output "Wrong username password combination".what is the reason for that?
<?php
$query = mysql_query($sql);
if (!$query)
{
echo 'Invalid query: ' . mysql_error() . "\n";
die($message);
}
if (mysql_fetch_assoc($query))
{
$query = mysql_query($sql);
$row = mysql_fetch_assoc($query);
if ($row['un'] == $un && $row['pd'] == $encpass)
{
echo "<h1>WellCome</h1>";
echo '<br /><a href="home.php?' . SID . '">page 2</a>';
echo $row['un'];
}
else
{
echo "Wrong user name password combination";
}
}
?>