+ Post New Thread
Results 1 to 3 of 3
Web Development Thread, Copy and Append in MySQL in Coding and Web Development; I have a MySQL database with a productnumber and productimages field. The productnumber field already has data in it eg. ...
  1. #1

    Join Date
    Dec 2008
    Posts
    11
    Thank Post
    8
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Copy and Append in MySQL

    I have a MySQL database with a productnumber and productimages field. The productnumber field already has data in it eg. prod001, prod002 etc
    So I was wondering if anyone knew if there was an easy way to copy the data into the productnumber field but change it so that it was in the format images/productnumber.jpg (images/prod001.jpg images/prod002.jpg) etc.
    I'm pretty new to all this database stuff if you cant already tell

    Cheers

    Edit: Been trying this but it doesn't seem to like it very much
    update products set `productimages` = 'images/' + `productnumber` + '.jpg';
    Last edited by UproarUK; 9th August 2009 at 12:08 AM.

  2. #2

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Code:
    UPDATE <table> SET `productimages`= CONCAT('images/',  `productnumber`, '.jpg')

  3. Thanks to powdarrmonkey from:

    UproarUK (9th August 2009)

  4. #3

    Join Date
    Dec 2008
    Posts
    11
    Thank Post
    8
    Thanked 1 Time in 1 Post
    Rep Power
    0
    wow that was quick. Worked a treat, cheers

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 9
    Last Post: 10th February 2009, 02:46 AM
  2. Mysql - Copy column to table3
    By danIT in forum Scripts
    Replies: 0
    Last Post: 30th January 2009, 11:23 AM
  3. Append count() to Div/class
    By danIT in forum Web Development
    Replies: 3
    Last Post: 1st September 2008, 04:52 PM
  4. Replies: 1
    Last Post: 4th June 2008, 11:03 AM
  5. Replies: 1
    Last Post: 1st February 2008, 11:32 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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