backslash - Need to select only data that contains backslashes in MySQL -


i'm attempting correct entries in database have been double-escaped. believe magic_quotes on while mysql_real_escape_string being used. double-escaping has caused search results incorrect/missing.

i've turned magic_quotes off , planning search entries backslash , update them remove double-escaping. trouble is, when perform query search entries backslashes, no results.

select title exampletable title '%\\\\%' 

i'm using '%\\\\%' recommended here: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like

if output every title, many of them have unwanted backslashes, know they're there. can't seem isolate them in query.

example data: old king\'s road running down dream can\'t stop sun one's me 

again, trying return entries \ in them.


edit: mysql version 5.0.92-community. collation latin1_swedish_ci. charset utf-8 unicode

%\\% not work. i've tried. listed incorrect on mysql.com:

to search “\”, specify “\\\\”; because backslashes stripped once parser , again when pattern match made, leaving single backslash matched against.

this command works me when i'm running command php:

select * exampletable title '%\\\\\\\\%' or title '\\\\\\\\%' or title '%\\\\'; 

the reason include beginning, anywhere, , end matches show different. if you're looking backslashes on end, there needs 4 backslashes. because there nothing escape after it. use 8 backslashes on other commands because parsed php.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -