Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用mysql_real_escape_string()时拒绝对www数据的Joomla访问_Php_Mysql_Joomla_Joomla1.6 - Fatal编程技术网

Php 使用mysql_real_escape_string()时拒绝对www数据的Joomla访问

Php 使用mysql_real_escape_string()时拒绝对www数据的Joomla访问,php,mysql,joomla,joomla1.6,Php,Mysql,Joomla,Joomla1.6,我在使用Joomla开发的代码中使用了mysql\u real\u escape\u string($somevariable)!应用程序编程接口。 除了这个问题显示出错误外,一切都很顺利 mysql\u real\u escape\u string():在/var/www/JOOMLA/components/com\u quick/models/questions.php中拒绝用户“www data”@“localhost”(使用密码:NO)的访问 我在互联网上搜索,得到了以下解决方案: 创建

我在使用Joomla开发的代码中使用了mysql\u real\u escape\u string($somevariable)!应用程序编程接口。 除了这个问题显示出错误外,一切都很顺利

mysql\u real\u escape\u string():在/var/www/JOOMLA/components/com\u quick/models/questions.php中拒绝用户“www data”@“localhost”(使用密码:NO)的访问

我在互联网上搜索,得到了以下解决方案: 创建一个
$con=mysql\u连接(…)
并将其作为
mysql\u real\u escape\u字符串($somevariable,$con)
中的第二个参数传递,该参数工作正常

问题是我在代码中的任何地方都在使用Joomla API,那么我可以使用默认的Joomla db对象吗用于此

基本上我想要的是
$db=&JFactory::getDBO()
mysql\u real\u escape\u字符串($somevariable,$db)

但它显示了错误:
mysql\u real\u escape\u string()希望参数2是第85行/var/www/JOOMLA/components/com\u quick/models/questions.php中给出的资源和对象


谢谢。

如果使用Joomla数据库对象进行查询,为什么要使用mysql库的转义函数?你不需要。下面介绍如何使用DBO创建正确转义的SQL查询。

如果使用Joomla数据库对象进行查询,为什么要使用mysql库的转义函数?你不需要。下面介绍如何使用DBO创建正确转义的SQL查询。

使用$db->quote($somevariable)

改用$db->quote($somevariable)

谢谢这是我要找的:)谢谢这是我要找的:)