Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,683
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Appending to an existing table record?

    Hello,

    I am writing a simple "mini-blog" for my website. I don't want all the works of a wordpress or other program so I am just using a text area to update one of the fields in my table.

    Is there a way to simply add extra data on the end of a mysql table record without reading the exiesting data into a variable, appending the new info and then UPDATE'ing the record ?

    Thanks for any info

  2. #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    15,005
    Thanks
    164
    Thanked 2,244 Times in 2,231 Posts
    Code:
    update table_name set filed_name=concat(filed_name,'new string') where...
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  3. #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,683
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Yes - thats it !

    I have been reading about concat() but couldn't see how to use it !

    So UPDATE tbl SET fld = CONCAT(fld, 'new text'); should do the business
    Thanks


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •