How to escape strings in SQL Server using PHP?

前端 未结 14 1621
我寻月下人不归
我寻月下人不归 2020-11-22 09:36

I\'m looking for the alternative of mysql_real_escape_string() for SQL Server. Is addslashes() my best option or there is another alternative funct

14条回答
  •  一整个雨季
    2020-11-22 09:54

    I have been using this as an alternative of mysql_real_escape_string():

    function htmlsan($htmlsanitize){
        return $htmlsanitize = htmlspecialchars($htmlsanitize, ENT_QUOTES, 'UTF-8');
    }
    $data = "Whatever the value's is";
    $data = stripslashes(htmlsan($data));
    

提交回复
热议问题