I want to update the password in the database. And I can’t have tried everything. I do not understand what is wrong (here is the form of changing the password
<input type="password" placeholder="Old password" name="lastpass" value=""> <input type="password" placeholder="New password" name="newpass" value="" > <input type="password" placeholder="Repeat new password" name="newpassw" value="" > <input type="submit" class="btn_savechange" value="Save" name="savech" />
Here's a password change code that doesn't work.
<?php if(isset($_POST['savech'])) { $lastpass = $_POST['lastpass']; $newpass = $_POST['newpass']; $newpassw = $_POST['newpassw']; if ($newpassw == $newpass) { $qery = mysql_query("SELECT * FROM users WHERE login = 'login'") or die(mysql_error()); if (mysql_num_rows($qery) == 1) { $updated = "UPDATE users SET password = '$newpass' WHERE login = 'login'"; if(mysql_num_rows($update) > 0) { echo "Good"; } else { echo "mistake"; } } else { echo "Oshibka"; } } } ?>
The user is authorized and the data is recorded in sessions. Maybe through them you need to pull it out. Help code fix.