Previous Thread
Next Thread
Print Thread
Hop To
#259316 02/24/2017 11:35 AM
Joined: May 2008
Posts: 753
Likes: 1
Old Hand
Old Hand
Joined: May 2008
Posts: 753
Likes: 1
a couple of years ago I sold my vannin.com domain name, and have been using vanninG.com since.

I still have tons of old posts that contain the old url.

how would I run a sql query to find and replace ann instances of vannin.com with vanning.com in user posts?

this is what I came up with, but don't want to run it without being sure.


Code
UPDATE
    [ ubbt_POSTS ]
SET
    [ POST_BODY ] =
REPLACE
    ([ POST_BODY ], '[vannin]', '[vanning]');


"No matter where you go, there you are."
"If you can't do something smart, Do something right"
"There are three kinds of people in the world, those who can count, and those who can't"
Joined: May 2008
Posts: 753
Likes: 1
Old Hand
Old Hand
Joined: May 2008
Posts: 753
Likes: 1
or would this be better?

Code
update UBB_POSTS set POST_BODY = replace(
POST_BODY, 'http://vannin.com/',
'https://www.vanning.com/');


"No matter where you go, there you are."
"If you can't do something smart, Do something right"
"There are three kinds of people in the world, those who can count, and those who can't"
Joined: May 2008
Posts: 753
Likes: 1
Old Hand
Old Hand
Joined: May 2008
Posts: 753
Likes: 1
I tried the second one, it seemed to work.
I had a post open with the old link, ran that, looked again and the links appeared to be correct, but when I went to look at it via edit, they were still the old link.
it changed how it appeared visibly in the post, but not the actual url.


"No matter where you go, there you are."
"If you can't do something smart, Do something right"
"There are three kinds of people in the world, those who can count, and those who can't"
Joined: Apr 2004
Posts: 1,945
Likes: 145
UBB.threads Developer
UBB.threads Developer
Joined: Apr 2004
Posts: 1,945
Likes: 145
** MAKE A BACKUP
** BE VERY CAREFUL OF "POST_DEFAULT_BODY" and "POST_BODY" USAGE - DO NOT INTERCHANGE THEM


• POST_DEFAULT_BODY
[BBcode] - this is the original post. CONTENT REBUILDER > REBUILD POSTS takes this and converts it to POST_BODY [HTML]

• POST_BODY
[HTML] - this is shown to the user. it is generated from POST_DEFAULT_BODY

USAGE EXAMPLE FOR HTTP => HTTPS
UPDATE ubbt_POSTS
SET POST_BODY = replace(POST_BODY, 'http://EXAMPLE.com', 'https://EXAMPLE.com')

Run CONTENT REBUILDER > REBUILD POSTS afterwards.

---

FOR REFERENCE:

Posts
  • ubbt_TOPICS - TOPIC_SUBJECT
  • ubbt_POSTS - POST_SUBJECT
  • ubbt_POSTS - POST_DEFAULT_BODY
  • ubbt_POSTS - POST_BODY

Private Messages
  • ubbt_PRIVATE_MESSAGE_TOPICS - TOPIC_SUBJECT
  • ubbt_PRIVATE_MESSAGE_POSTS - POST_DEFAULT_BODY
  • ubbt_PRIVATE_MESSAGE_POSTS - POST_BODY

Profiles
  • ubbt_USER_PROFILE - USER_AVATAR
  • ubbt_PROFILE_COMMENTS - COMMENT_BODY


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: May 2008
Posts: 753
Likes: 1
Old Hand
Old Hand
Joined: May 2008
Posts: 753
Likes: 1
so.. I would want


Code
UPDATE
    UBB_POSTS
SET
    POST_DEFAULT_BODY =
REPLACE
    (
        POST_DEFAULT_BODY,
        'http://vannin.com/',
        'https://www.vanning.com/'
    );


"No matter where you go, there you are."
"If you can't do something smart, Do something right"
"There are three kinds of people in the world, those who can count, and those who can't"
Joined: May 2008
Posts: 753
Likes: 1
Old Hand
Old Hand
Joined: May 2008
Posts: 753
Likes: 1
oh, I see your example, just formatted differently, but says the same thing.
thanks!


"No matter where you go, there you are."
"If you can't do something smart, Do something right"
"There are three kinds of people in the world, those who can count, and those who can't"
Joined: Apr 2004
Posts: 1,945
Likes: 145
UBB.threads Developer
UBB.threads Developer
Joined: Apr 2004
Posts: 1,945
Likes: 145
yes. thats correct. and then run your content rebuilder afterwards.

Its advised that you should probably close your forums when making multiple wide-scale database changes such as these. the Content Rebuilder already closes your forum while its doing its work. In addition, if you are making changes that touch many of your largest tables at once, be sure to have a backup. A backup is something you hope you never need, but glad you have it if you ever do need it.


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
0 members (), 686 guests, and 131 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)