Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

search and replace in mysql tables

posted by Krow on 04:05 PM July 25th, 2001   Printer-friendly   Email story
n8 writes "I was changing the URL and siteid of a slash site, and I wanted to change every occurence of the old domain name in the vars table. I figured out that you can do this in mySQL using the replace() string function:

UPDATE vars SET value = replace(value, 'newvalue', 'oldvalue') WHERE value REGEXP 'oldvalue';

You could do something similar with the templates table too (though the template-tool has a substitution feature also). But be careful with this sort of thing! You could omit the WHERE clause too."

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.