dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Moved articles, need to change urls in database

  1. #1
    Join Date
    Oct 2006
    Location
    Ables Springs, Texas
    Posts
    183

    resolved [RESOLVED] Moved articles, need to change urls in database

    I've tried several querys in an attempt to change the urls of my articles stored in my database. So far, none have worked. Here's an example:
    Code:
    UPDATE `articles`
    SET 'url' LIKE '%http://www.newsite.com/library%'
    WHERE `url` LIKE '%http://www.old-site.com/articles%'

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,295
    How about....
    Code:
    UPDATE `articles`
    SET `url` = REPLACE(`url`, 'http://www.old-site.com/articles', 'http://www.newsite.com/library')
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Oct 2006
    Location
    Ables Springs, Texas
    Posts
    183
    Thanks NogDog. Here's the final solution:
    Code:
    UPDATE articles SET  url = replace(url, 'http://www.old-site.com/articles', 'http://www.newsite.com/library')
    For reference, see http://www.sqlteam.com/article/using...date-statement

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles