MySQL, UPDATE data into a database using CONCAT()
To insert data into a MySQL database while preserving the already existing data, you will just concatenate your new data to the end of your existing data.
Below is an example of how to do it using the column “changelog” which is used to keep track of changes made to the row/record.
View Code MYSQL
UPDATE table1 SET changelog=CONCAT(changelog,"new data") WHERE id='idnumber' |
If you would like the data that you are entering to appear at the beginning of the existing data, simply flip the concatenation, example:
View Code MYSQL
UPDATE table1 SET changelog=CONCAT("new data",changelog) WHERE id='idnumber' |




