I am trying to insert a new password into the password column of my users table. I am passing two variables to the SQL query, the new password and the user ID, but I cannot get it to work no matter what I do. Here is the SQL query:
$sql = "INSERT INTO cryptuser WHERE userID ='" . $userid ."' (passwordnew)
VALUES ('$passwordnew') ";
Here is my form:
<fieldset>
<legend>Change Password</legend>
<form action="changepass.php" method="POST">
<label>Current Password :</label>
<input type="password" name="password" /><br />
<label>New Password :</label>
<input type="password" name="passwordnew" /><br/>
<label>Repeat New Password :</label>
<input type="password" name="passwordnewRepeat" /><br/>
<input class="signbutt" type="submit" value="Save"/><br />
</form>
Once I can change the password stored in the table, then I will create further SQL that will only change the password to the new value if the current password entered matches the existing password, then JavaScript to make sure the re-entered password matches the new password.