IChaps Posted April 5, 2016 Share Posted April 5, 2016 Hello, Can I please ask, how do I go about updating a entry in a database? I'm trying to create a Forgotten Password feature. I can open a database, and locate the required entry. But each time I try and replace the old password with a new one. The database is not been updated. My update reads:- $sql = ("UPDATE registration SET Password='$old_pass', WHERE $row[0]='$userID'"); May I ask how should I proceed? Thank You. 1 Link to comment Share on other sites More sharing options...
justsomeguy Posted April 5, 2016 Share Posted April 5, 2016 There's an errant comma there, but print that $sql variable out to see exactly what you're sending to the database. You should really be using prepared statements for that though instead of putting the data directly in the query. Link to comment Share on other sites More sharing options...
IChaps Posted April 20, 2016 Author Share Posted April 20, 2016 Hello Justsomeguy. Thank you for your reply and help. I've re-build the file line by line, and found the error. (it took me a while). There was a line missing, and it was not writing back to the database, as well as the error in the line you mentioned. Kind Regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now