Hello. I'm amking a small control panel for the website I'm working on, and it allows the user to change their password. BUT only if they have entered their old password correctly and supplied two new identical passwords. The problem is that php thinks that $newp and $newp2 are equal, even when they arn't. Heres the code:
<?php
if($newp == $newp2) {
$conn = mysql_connect("localhost","","");
$db = mysql_select_db("users", $conn);
$psql = "select password from users where tag=\"$user\" ";
$pqr = mysql_query($psql, $conn);
while( $row < mysql_num_rows($pqr) ) {
if($row["password"] = " password(\"$oldp\" ) " )
{
$sql = "update users set password=password( \" $newp \" ) where tag=\"$user\" ";
$qr = mysql_query($sql, $conn);
if($qr) {
$msg = "<br><b>Password has been changed</b>";
echo($msg);
}
} else { $er1 = "<b> You entered an incorrect old password</b><br>"; }
}
} else { $er2 = "<b>You did not enter two new identical passwords.</b>"; }
echo($er1);
echo($er2);
?>
Any help much appreachiated.
N.B. $user is a session storing the users username.