Peter Bargh

words pictures sounds
September 6th, 2013 by Peter Bargh

double quotes replaced by backslash on mysql update

I had a situation where I had to export a set of records from a MYSQL database on a live site into a copy database on a localhost site. After successfully making the export / import I found all the picture and url links on the WordPress posts broken. Closer inspection relieved that the import had replaced all the necessary double quotes around links, styles, etc had been replaced with backslashes.

 

If you’re in the same position there’s a quick remedy. the following myqsl statement will find and replace

copy it and change the italic parts to match your set up

UPDATE your table name SET your field name = replace(your field name, ‘\’, ‘”‘);

 

Leave a Reply

Your email address will not be published. Required fields are marked *