mysql_real_escape_string() leaving slashes in MySQL

前端 未结 9 1099
囚心锁ツ
囚心锁ツ 2020-12-16 16:41

I just moved to a new hosting company and now whenever a string gets escaped using:

mysql_real_escape_string($str);

the slashes remain in the

9条回答
  •  生来不讨喜
    2020-12-16 17:00

    mysql_real_escape_string($str); is supposed to do exactly that. it is meant to add backslashes to special characters especially when you want to pass the query to mysql. Take note that it also takes into account the character set of mysql.

    For safer coding practices it would be good to edit your code and use stripslashes() to read out the data and remove the slashes.

提交回复
热议问题