PHP Echo Tutorials

Add Data To Existing Column String

Written by phpecho.com   

Sometimes you might want to update a string in a column without deleting what's already in that column, say for instance if you have a list of dog breeds (Alsation, Beagle, Labrador etc) in a Title column and you want to add the word Dogs to every entry - in which case you can do the following:

UPDATE dogs_breeds SET breed = CONCAT(breed,' Dogs.');

Notice there is a space before Dogs (breed,' Dogs.') so that you are adding a space and the word Dogs to Alsation, Beagle, Labrador etc, so they become Alsation Dogs, Beagle Dogs and Labrador Dogs and so on.