加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – mysql_real_escape_string()完全删除字符串

发布时间:2020-12-13 16:02:59 所属栏目:PHP教程 来源:网络整理
导读:我正在逃避从php表单收到的所有字符串参数,如下所示: $usr_name = mysql_real_escape_string($_REQUEST['usr_name']); 避免SQL注入的一些问题.但是当我从函数中恢复我的字符串时,我什么都没有结果. 另外,我在PHP日志中不断收到这个奇怪的警告: PHP Warning
我正在逃避从php表单收到的所有字符串参数,如下所示:
$usr_name = mysql_real_escape_string($_REQUEST['usr_name']);

避免SQL注入的一些问题.但是当我从函数中恢复我的字符串时,我什么都没有结果.

另外,我在PHP日志中不断收到这个奇怪的警告:

PHP Warning:  mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: A link to the server could not be established in /hermes/bosweb/web279/b2798/ipw.bankingforms/public_html/formAckResponse_controller.php on line 39

主机使用:PHP版本4.4.7

从 PHP.net:起

Note: A MySQL connection is required
before using
mysql_real_escape_string() otherwise
an error of level E_WARNING is
generated,and FALSE is returned. If
link_identifier isn’t defined,the
last MySQL connection is used.

换句话说,在使用此功能之前,您需要通过mysql_connect()或mysql_pconnect()连接到MySQL数据库.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读