Forum Moderators: phranque
I have a full text field that is in a particular table. Does anyone know if there is a way to run a find and replace command on this field.
For info the field is lots of html text, and the text I want to change is a particular URL within this text.
Any syntax code would be greatly appreciated.
Thanks
PS I have PHPMyAdmin nothing else to connect.
Ex.
UPDATE table SET field1='somethingelse' WHERE field1='something';
As far as replacing just a portion of text with the field, I'm not sure if that is possible in MySQL or not. However, it would be very easy to do with a very short php or perl script.
The manual is your friend..
[google.ca...]
Gave me the following:
[dev.mysql.com...]
Which highlights this useful function:
REPLACE(str,from_str,to_str)
So... the following should replace all instances of "foo" in your string with "bar":
UPDATE table SET field1=REPLACE(field1, 'foo','bar')
Hmm... it's a friday night and I'm making stupid programmer foobar jokes... gotta get out!