What is the difference between mysql_real_escape_string and addslashes?

后端 未结 5 1383
野性不改
野性不改 2020-12-31 15:32

mysql_real_escape_string and addslashes are both used to escape data before the database query, so what\'s the difference? (This question is not ab

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 15:54

    It seems that mysql_real_escape_string is binary-safe - the documentation states:

    If binary data is to be inserted, this function must be used.

    I think it's probably safer to always use mysql_real_escape_string than addslashes.

提交回复
热议问题