» Birthday Bundle - Over $400 worth of Envato files for just $20

How to add a suffix to a field’s value

Posted on August 30, 2008, Filled under PHP,  Bookmark it

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!

Get our RSS Feed!

Leave a Reply


* = required fields

  (will not be published)


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Note: If you want to post CODE Snippets, please make them postable first!
(e.g. <br /> should be converted to &lt;br /&gt;)