I just curious about updating mysql table record (in connection with php) as follows.
-
Update a value. Eg: In mysql table it has value “100”. User wants add “50” to that value. Using php code pass “50” to mysql table and it adds “50” to “100” and update to “150”.
-
Append data to a existing value.
Eg: There is already a number in mysql table field “Contact” (0123456789)and new number should be append to the same field and separate using a comma or something (0123456789, 9876543210). Not using fields contact1, contact2 etc.
I am asking this normally we retrieve all the data from the table and do all the mathematical operations and after all we overwrite and update the table. Is there a way in the dbms to manage this kind of situation?
for 1 you could use
and for two you could use
but using csv in a database is only a good thing in certain situstions. This is not one of them I think. I would use a one to many relation with a seperate table. Consider the following.