How should I escape characters inside this LIKE query?

后端 未结 3 869
北恋
北恋 2021-01-13 03:25

I have a field in one of my tables that contains this string:

!\"#¤%&/()=?´`?=)(/&%¤#\"!\\\'\\\'\"\'

(Only for test purposes ofcour

3条回答
  •  一个人的身影
    2021-01-13 04:19

    Are you using PHP? If so, you may try something like:

    $a = mysql_real_escape_string('%!"#¤%&/()=?´`?=)(/&%¤#"!\'\'"\'%');
    $query_string = "SELECT * FROM mytable WHERE `column` LIKE '$a'";
    

    Would that solve your problem?

提交回复
热议问题