1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 sql search and replace

Discussion in 'XenForo Questions and Support' started by thiaago13, Jan 25, 2014.

  1. thiaago13

    thiaago13 Member

    I need to change a old site name for another in all posts / topics , please a sql command for this?
  2. AndyB

    AndyB Well-Known Member

    To update posts I use this in phpMyAdmin

    UPDATE xf_post SET message = REPLACE(message, 'old text', 'new text')
  3. thiaago13

    thiaago13 Member

    thanks :D

    and threads?
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You only need to update the post table.
  5. cmeinck

    cmeinck Well-Known Member

    Following up my title post, I'd like to do something similar within posts. However, my concern is that it will also affect URLs that have the same term. For example, if I do this:

    UPDATE xf_post SET message = REPLACE(message, 'iphone','iPhone');
    Any website with iphone in the URL would change to http://iPhone.apple.com instead of the proper http://iphone.apple.com

    Would this second run address specific cases?

    UPDATE xf_post SET message = REPLACE(message, 'iPhone.apple','iphone.apple');
    I don't want to adversely affect other words with the replace, so using caution and seeking advice. Does it see iPhone.apple as a single term?
  6. AndyB

    AndyB Well-Known Member


    cmeinck likes this.

Share This Page