Results 1 to 4 of 4
Hello,
i want to run a find and replace query in my sql database using php my admin. The problem is that in the text that i want to find ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-30-2012 #1Just Joined!
- Join Date
- Oct 2012
- Posts
- 2
SQL Query for Find and Replace is not working
Hello,
i want to run a find and replace query in my sql database using php my admin. The problem is that in the text that i want to find and replace are some " characters and this causes problems when i run the command...
i want to search for align="right"> and replace it by align="left">
i did run this command but its not working:
UPDATE `ps_product_lang` SET `description` = replace(`description`,"align="right">","align="lef t">");
So im wondering how should this query look like as there are " characters? How is it possible to search for even much longer text and replace it using sql queries?
many thanks
- 10-30-2012 #2Linux Enthusiast
- Join Date
- Apr 2004
- Location
- UK
- Posts
- 678
Hi there,
You need to escape the quote marks you that are part of the text you are searching for. So something like: "align=\"right\">".
I'm not sure what you mean how searching for longer text. As long as the MySql doesn't choke on the string you should be fine.
Let us know how you get on.To be good, you must first be bad. "Newbie" is a rank, not a slight.
- 10-30-2012 #3Just Joined!
- Join Date
- Oct 2012
- Posts
- 2
- 10-30-2012 #4Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,700
Glad you got it sorted, and thanks for posting your solution.
Marking thread as Solved.




