PDA

View Full Version : A Query to perform a text substitution


memobug
09-18-2004, 01:19 AM
Greetings,

I am asking this question here after I didn't get any response on vbulletin.com. There's probably more general MySQL/Programming knowledge here anyway.

THE PROBLEM: I need to do a global substitution on unique text in the POST table's PAGETEXT field.

More specifically I need to substitute

[img]http://onedomain.com/.... for [img]http://anotherdomain.com/...

Is there some phpmyadmin UPDATE command I can run on my database to do something like this?

MORE DETAILS:

The reason I need to do this is that vb3 handles [img] tags differently than vb2.x. Before, if no domain was specified, the [img] links became relative paths. Now if no link is specified, it just prints out the bbcode with no link.

Many thanks,

Matt

Natch
09-20-2004, 12:34 AM
I did this recently: this query structure will help UPDATE table SET field = replace(field, 'searchtext', 'replacetext');

BACK UP YOUR DATABASE FIRST OF COURSE.

memobug
09-20-2004, 12:26 PM
Thanks Natch. I did get a response from another kind gentleman over on Vbulletin.com that had the identical suggestion. I also used it to remove some nasty nbsp; things that were left in there.

Sort of electronic high colonics (maybe semicolon-ics)?

Regards,

Matt

Natch
09-20-2004, 12:37 PM
  is code for a non-breaking space - you can daisy-chain them together to space out text, to ensure that a exact number of spaces will appear in a location in an HTML page. Normally if you put a lof od spaces, the HTML renderer will only render one.

NP - glad to help out ;)