change value in text type field

javi_m posted 7 years ago in Running SQL scripts
Hi Everyone!

I need some help with this.

I¡m using Joomla!, wich as default parameter puts all the article images in a single folder.

So, i need to reorder that images. That's not a problem itself. The problem is to give the joomla articles the new image path.

For example: OLD path: mysite.com/images/stories/image.jpg
NEW path: mysite.com/images/stories/NEWFOLDER/image.jpg

The image path is stored in a text type field, so... how can i change the paths with a sql script?

Like... change images/stories to images/stories/NEWFOLDER in all the records from x field, in x table... ?


(Sorry about my poor english)
ansgar posted 7 years ago
UPDATE <yourtable> SET <colname> = REPLACE(<colname>, 'from_str', 'to_str')
javi_m posted 7 years ago
Thanks a lot anse!


Please login to leave a reply, or register at first.