Forum Moderators: open

Message Too Old, No Replies

Newbie learner

         

internetheaven

10:24 am on Feb 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In a CMS database there is an image url in some entries that needs to be changed, with 100+ pages it will take a long time to do manually. Is there a find/replace function with SQL that I can run to change them all?

I only know small amounts about databases, I want to accomplish:

/images/imagename.gif changed to /images/imagehere.jpg

Any help would be appreciated
Thanks
Mike

wheelie34

1:23 pm on Feb 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use UPDATE while in PhpMyAdmin, hit the SQL tab and in the white area try this

update TABLENAME set COLUMN='/images/imagehere.jpg' where COLUMN='/images/imagename.gif';

Change TABLENAME and COLUMN to suit your database

internetheaven

1:44 pm on Feb 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the reply, but not five minutes after posting a colleague I was speaking to gave me this:

update table_name set table_field = replace(table_field,'replace_that','with_this');

which worked fine. Apparently he has started to learn how to manage his own databasese too! :)

Thanks
Mike