Adding a text box value to a current MySQL record

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Adding a text box value to a current MySQL record

Post by impulse() »

I have a form at the moment and I want the value of the text box to be added onto a field in a MySQL DB. I don't want the value to replace the exists value, but to add it on. Is there an option to do this?
I'm aware that I could extract the data into a variable and then add the text box value onto it and then insert that value into the DB but that's going to prove tricky in my instance.

Regards,
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

UPDATE tableName SET fieldName = CONCAT(fieldName, 'foo') WHERE someField = 'foo'
Post Reply