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
    140

    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
    19,633
    How about....
    Code:
    UPDATE `articles`
    SET `url` = REPLACE(`url`, 'http://www.old-site.com/articles', 'http://www.newsite.com/library')
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Oct 2006
    Location
    Ables Springs, Texas
    Posts
    140
    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