I want to match \'
in my a column in a table in a MySQL Database, because these are entries where the data wasn't properly escaped.
I use PHP with PDO, this is the relevant code:
$stmt = $db->prepare("SELECT * FROM table WHERE title LIKE :title");
$stmt->bindValue(':title',"%\\'%",PDO::PARAM_STR);
Problem is, this matches titles with \'
as well with a single '. I tried various combinations of \\\\\'
etc., but nothing really worked to just match \'
, not the single '
.
What am I doing wrong?