php - What will be search query where the search key may contain special characters? -


i have table column allows special characters / , \ , @ , $ .

now when trying search such records table, unable get. i have tried 1 query returning 0 rows there 1 record existing. how write query in case ?

my query (which giving wrong result) this

select * mytable column7 '%jk\xyz@%'  

you may need escape special characters - particularly backslash. note operator - there 2 part process issuing command & both strip escaping - search single backslash need use 4 backslashes.

select * mytable column7 '%jk\\\\xyz@%'  

see : mysql operator wildcard , backslash , http://dev.mysql.com/doc/refman/5.6/en/string-comparison-functions.html#operator_like


Comments