How to add a suffix to a field’s value
Posted on August 30, 2008, Filled under PHP,
Bookmark it
Thanks for visiting our website! We regularly publish posts like this one. If you are interested in receiving the latest updates as soon as they are posted, please consider subscribing to the RSS feed or to our e-mail newsletter.
Greetings,
Ever wanted to add a suffix to a mysql field’s value? The CONCAT string function can help you. Here’s how you can do it:
UPDATE `your_table` SET field_name = CONCAT(field_name, ' my suffix here') where field_name='the field value here'; #optional condition
So if the field’s value if “New York” and you add the suffix ” City” then our sql command will make the update and the new field’s value will be “New York City”. (notice the space added before the suffix. In our example it was necessary).
Good luck!
Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!
- August 30, 2008
- article by Gabriel C.
- Leave a reply!
Sponsors
Related Posts
-
How to add a prefix to a field’s valueat August 30, 2008 with 1 comment
-
Update table field by replacing a string value with a new oneat August 28, 2008
-
Create, Customize and Send Newsletters: MeeNewsat August 3, 2009 with 1 comment
-
Custom Field Template – An Effective Way to Add Extra Metadata to a Wordpress Postat May 2, 2009 with 1 comment
