Jump to content

[SOLVED] adding text to contents of a database table


ukscotth

Recommended Posts

Hi,

 

I have a database table which is full of paths to pictures e.g

 

/pictures/12313213.jpg

/pictures/35423454.jpg

 

Id like to change all the data to a longer path, basically i need to add some text to the beginning of every entry so the table contains things like this instead :

 

http://www.blahblah.com/pictures/12313213.jpg

http://www.blahblah.com/pictures/35423454.jpg

 

Can someone show me how plzzzzz ?

 

thanks very much.

 

Scott

 

 

 

 

Link to comment
Share on other sites

As long as the first path is the same a simple update in phpMyAdmin will work using this SQL:

 

UPDATE table_name SET column_name = CONCAT('http://www.blahblah.com', column_name)

 

That should work, I have never done it so I could be wrong... I would do a test on one table element first by adding a WHERE clause to that so you do not screw up your whole table (or backup for table).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.