How to add a prefix to a field’s value

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

Greetings,

Ever wanted to add a preffix 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('my prefix here ', field_name)
where field_name='the field value here'; #optional condition

Example: You can use this command to add a prefix for a telephone number.

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!

One Reply to "How to add a prefix to a field’s value"

  1. Brilliant tip worked a treat.

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;)