|
Written by Trevor Gontz
|
|
Monday, 13 November 2006 |
|
Page 2 of 2 To search and replace a text string, start up phpMyAdmin, and click on your database name that you want to run the search and replace through. At the top of the window, click on the "SQL" tab.
In the text box, enter the following code. This is the generic setup, so edit to satisfy your needs:
UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring"); Example: To search and replace text in the content area of your Joomla! site use jos_content for the tablename and introtext for the tablefield as shown in the example below: UPDATE jos_content SET introtext = replace(introtext, "original text","new text"); You can add a WHERE clause onto this as well.
For example, here is one command a ran:
UPDATE `mos2_content` SET introtext = replace(introtext,"<p>","") WHERE `title` REGEXP '-0';
This got rid of all paragraph tags in the mos2_content table where the title included the string "-0". WHERE `field_id` =41
|
|
Last Updated ( Friday, 23 February 2007 )
|