I have tried to work this code the whole day I seem to get no where. Can please someone help me see the mistake.

The code is supposed to be changing the user password. What happen is ; I get these messages You entered an incorrect password. Try Again Congratulations! You have successfully changed your password. Continue

And if I check in the database the password field is being erased!...please help....the form:

I have re-write the code but it seem to be working only when the username and the oldpassword are the same.

If one enters a wrong username with correct password; I get these errorsWarning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in C:\wamp\www\change_passeord.php on line 24You entered an incorrect password. Try Again The new password and confirm new password fields must be the same. Try Again

correct username wrong password I get:You entered an incorrect password. Try Again The new password and confirm new password fields must be the same. Try Again