September 28, 2008
How to overwrite / update a previous record automatically in 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?
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?
Filed under Programming & Design by administrator

Comments on How to overwrite / update a previous record automatically in mySQL?
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”.
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