I have this php script, which update password from mysql table named as "admin" but when I post the data It doesn't update the password.
Note: the script look the input name and exist name if is the same it update the password of such name. Can any one help me to solve this Am new in PHP.
Here the script
<?php
$fname='fname';
$con=mysql_connect("localhost","root","mcl");
mysql_select_db("mcl",$con);
$user = $_POST['fname'];
$pass = $_POST['password'];
$result = mysql_query("SELECT password FROM admin WHERE fname='$fname'");
if(!$result)
{
echo "The username you entered does not exist";
}
{
echo"<a href=update.htm> Click here to signin</a>";
exit;
}
if($user='fname')
$sql=mysql_query("UPDATE admin SET password='$pass' where fname='$user'");
if($sql)
{
echo "Congratulations You have successfully changed your password";
echo"<br>";
echo"<a href=index.php> Click here to signin </a>";
exit;
}
{
echo "The new password fail to update";
}
?>
Dont wory about msqli I will consider that.