douming4359 2011-01-26 08:20
浏览 87
已采纳

在MySQLi中绑定参数和转义字符串(PHP)

I bind all variables to all kind of statements (UPDATE/INSERT/SELECT etc.) using the bind_param() function. But I am confused with bind params.

Do I also need to use real_escape_string even though I use bind_param? Are both of them completely different things?

  • 写回答

1条回答 默认 最新

  • douyu2817 2011-01-26 08:33
    关注

    No you don't need to escape them. Binding params eliminates the need for escaping by removing the dangers of string concatenation.

    With binding, you're essentially telling MySQL to use the contents of this variable as the value for this field.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部