I searched around and a very easy and quick way to search and replace text in a MySQL database is this query:
UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");
You can also use WHERE clause to filter your query. An example would be:
UPDATE `mos2_content` SET introtext = replace(introtext,"<p>","") WHERE `title` REGEXP '-0';
This one removes all<p> tags from the posts. Hope this helps you guys looking how to search and replace text in mysql.
Source: Zimmertech
No comments:
Post a Comment