Mysql replace question

Discussion in 'MySQL' started by sparksflying, Apr 29, 2007.

  1. #1
    Hi ,

    I have this one stumping me but probably a simple one...

    I have a field in a WordPress DB thats in the following format ;

    this is an example

    I need to change all of them to

    this-is-an-example

    I thought i could use :

    UPDATE `wp_posts` SET `post_name` = replace(`post_name`, '''', '-'); 
    Code (markup):
    But no Joy..

    Any ideas??
     
    sparksflying, Apr 29, 2007 IP
  2. sparksflying

    sparksflying Peon

    Messages:
    1,066
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Anyone out there? ;)
     
    sparksflying, Apr 29, 2007 IP
  3. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #3
    You were close :)

    UPDATE `wp_posts` SET `post_name` = replace(`post_name`, ' ', '-');
    Code (markup):
     
    SoKickIt, Apr 29, 2007 IP
    abdussamad likes this.
  4. sparksflying

    sparksflying Peon

    Messages:
    1,066
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Excellent , thanks!
    I couldnt be bold and ask if I could use the same to remove commas and questions marks in the same ? suppose i could..

    Rep on its way :0)
     
    sparksflying, Apr 30, 2007 IP
  5. sparksflying

    sparksflying Peon

    Messages:
    1,066
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry it wont let me leave you an itrader, sorry !
     
    sparksflying, Apr 30, 2007 IP
  6. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #6
    No problem.. you can leave an iTrader only in the "Buy, Sell or Trade" section.
     
    SoKickIt, Apr 30, 2007 IP