How to escape strings in SQL Server using PHP?

前端 未结 14 1651
我寻月下人不归
我寻月下人不归 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:47

    An answer from 2009-02-22T121000 by user chaos doesn't fit all queries.

    For example, "CREATE LOGIN [0x6f6c6f6c6f] FROM WINDOWS" will give you an exception.

    PS: look at the SQL Server driver for PHP, http://msdn.microsoft.com/library/cc296181%28v=sql.90%29.aspx and the sqlsrv_prepare function, which can binds parameters.

    PSS: Which also didn't help you with the query above ;)

提交回复
热议问题