PDA

View Full Version : Search and Replace a string of text that includes quotes?


GlitterKill
12-31-2006, 09:17 PM
I am using the following query to find and replace text in a table due to a site change/redesign. I want to know how to use it to find text that includes quotes as well.

UPDATE articles SET article_header = REPLACE (
article_header,
'74',
'60');

I want to be able to do quotes too like:

UPDATE articles SET article_header = REPLACE (
article_header,
'width="74"',
'width="60"');

But that is obviously not foing to work (i tried just to make sure :) and I need to know how to do it the correct way.

nico_swd
12-31-2006, 09:32 PM
addslashes() and stripslashes() do the trick.

http://es2.php.net/addslashes
http://es2.php.net/manual/en/function.stripslashes.php

GlitterKill
12-31-2006, 10:14 PM
And they go where? :) Can you format the query using the one I provided above?