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

 

 

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.