View Full Version : Need help with a query
Can someone show me a query I could use directly on the database that would search through EVERY message for a particular string and replace it with another string?
Or if that's not possible directly with a query, then a PHP script that would do it.
Mark Hensler
18 Mar 2002, 05:08
not tested.. just a concept....
UPDATE table_name SET field_name=REPLACE(field_name, "find string", "replace string") WHERE id_field IN (SELECT id_field FROM table_name WHERE field_name LIKE '%find_string%')
OR
UPDATE table_name SET field_name=REPLACE(field_name, "find string", "replace string") WHERE field_name LIKE '%find_string%'
mySQL Docs:
6.3.2 String Functions (http://www.mysql.com/doc/S/t/String_functions.html)
Aaow AnD wHiTe
21 Mar 2002, 15:51
Thanx, Mark :) We think that would be useful if you want to delete some smilies and don't want the code to stay in all messages. Has anyone tried it?
vBulletin® v3.6.12, Copyright ©2000-2013, Jelsoft Enterprises Ltd.