September 28, 2008

How to overwrite / update a previous record automatically in mySQL?

mysql
hockey_goalie31 asked:


I have a mysql database that receives the data from a php form that submits a unique user id, and 3 sports. I will likely be adding new fields (age etc) but the main thing I want to accomplish is if my users go through the form again (logged into to the same user id) and submit different information, how could I overwrite the old entry so I only have 1 record for the user?

hopefully this is possible one way or another !

Tags: , ,

Filed under Programming & Design by administrator

Permalink Print

Comments on How to overwrite / update a previous record automatically in mySQL?

September 29, 2008

? @ 3:50 am

use update…

“UPDATE usertable SET userid = 1234 WHERE userid = 4567″

This will update the row where userid is equal to 4567 to a new user id of 1234 on the table named “usertable”.

September 30, 2008

jmorge @ 1:44 am

use the “update” command.

the basic syntax of it is

UPDATE SET =, = WHERE =

remember to always use a Where clause otherwise it will update every row in your table…which is not what you want to happen