I am trying to fix database entries that have been double escaped. I believe that magic_quotes was turned on and mysql_real_escape_string was used. Double escaping resulted in incorrect / missing some search results.
I disabled magic_quotes and plan to search for backslash entries and update them to remove any double escaping. The problem is that when I execute a query to search for backslash entries, I always get no results.
SELECT title FROM exampletable WHERE title LIKE '%\\\\%'
I am using '% \\\\%' as recommended here: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like
If I print every heading, many of them have unwanted backslashes, so I know they are there. I just can't isolate them in the request.
Example Data: Old King\ Road Running Down A Dream Can\'t Stop The Sun This One For Me
Again, just trying to get the records back with \ in them.
EDIT: MySQL version 5.0.92-community. Collation - latin1_swedish_ci. Charset UTF-8 Unicode
% \\% Does not work. I tried. It is listed as invalid on mysql.com:
To find "\", specify it as "\\\\"; this is due to the fact that back braids break out once by the parser and again when the pattern matches, leaving a single backslash that needs to be matched.
source share