SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Coventry, England
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Complete Db search and replace

    Just a quick problem, I use a cms system for our client sites, in testing we host it on our own site which means links etc. to images, pages and files can sometimes have our url in them. I need a quick and easy way to do a search and replace on the whole database to change the url when we move it to the proper domain.

    Is there any way to do this, the system uses a MySQL database and I am fairly good at php coding.

    Thanks in advance,
    Ian

  2. #2
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A replace sounds good to me...
    Code:
    UPDATE tablename
    SET fieldname = replace(fieldname,'testurl', 'properurl') 
    WHERE fieldname
    LIKE '%testurl%'
    Lats...


Bookmarks

Posting Permissions

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