Jump to content

How do I use the mySqli Update please?


IChaps

Recommended Posts

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.

 

  • Like 1
Link to comment
Share on other sites

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

  • 3 weeks later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...