-1

How can I select a row in MySQL db where the value of a column contains ' and \ ?

For example, I want to select a column that matches this types of string:

https://www.mayoclinic.org/diseases-conditions/hirschsprung\'s-disease/symptoms-causes/syc-20351556

What can I do to achieve what I want?

Fabian N.
  • 3,807
  • 2
  • 23
  • 46
Arifin _
  • 5
  • 3
  • bit similar to this: https://stackoverflow.com/questions/881194/how-do-i-escape-special-characters-in-mysql – Eziz Durdyyev Jul 19 '18 at 07:46
  • 1. By properly escaping or binding your values into your query, the same way it is always done. 2. Why does your value contain a backlash? "hirschsprung\'s-disease" is probably _not_ the desired phrase, no? – deceze Jul 19 '18 at 08:25

1 Answers1

0

This should work, both characters must be escaped into the query:

SELECT * FROM `urls` WHERE text LIKE "%\\\\\'%" 
mitkosoft
  • 5,262
  • 1
  • 13
  • 31