4)) { $result = mysqli_query($conn,"UPDATE tbl_users SET user_password = '" . $new_pass . "' WHERE user_id='" . $userid . "'" ) or die ( mysqli_error($conn) ); $msg = "Password Changed Successfully"; if (! $result) { $msg = 'Error'; error_log("Failed to change the password."); } error_log("Password changed."); echo ""; //header("Location: index.php", true, 301);exit(); } else { echo ""; $msg = "Password and Confirm Password must be same OR Password length is less than 8 ."; error_log("Failed to change the password."); } } else { error_log("Passwords doesnt match.Current Password:".$POST['old_pass'].", DB OLD Password:". $row ['user_password']); $msg = "Old Password didnt match"; echo ""; } //} } ?>