Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.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 警告:mysqli_real_escape_string()需要两个参数,其中一个参数在。。。致命错误:在中对null调用成员函数query()_Php_Mysqli - Fatal编程技术网

Php 警告:mysqli_real_escape_string()需要两个参数,其中一个参数在。。。致命错误:在中对null调用成员函数query()

Php 警告:mysqli_real_escape_string()需要两个参数,其中一个参数在。。。致命错误:在中对null调用成员函数query(),php,mysqli,Php,Mysqli,我的数据库连接有问题,我真的不明白该怎么办。有人能帮我吗 警告:mysqli_real_escape_string()需要2个参数,1 在线/customers/f/4/7/zebratv.se/httpd.www/classes/db.php中给出 47致命错误:在中对null调用成员函数query() /customers/f/4/7/zebratv.se/httpd.www/classes/db.php,第61行 函数要求数据库链接作为第一个参数。所以改变 mysqli_real_esca

我的数据库连接有问题,我真的不明白该怎么办。有人能帮我吗

警告:mysqli_real_escape_string()需要2个参数,1 在线/customers/f/4/7/zebratv.se/httpd.www/classes/db.php中给出 47致命错误:在中对null调用成员函数query() /customers/f/4/7/zebratv.se/httpd.www/classes/db.php,第61行

函数要求数据库链接作为第一个参数。所以改变

mysqli_real_escape_string($x)

问题在于:

function sqlesc($x) {
     return "'".mysqli_real_escape_string($x)."'";
}
错误很简单——您只提供了一个参数,而应该提供两个

mysqli\u real\u excape\u string()
要求第一个参数为当前mysqli连接,第二个参数为字符串:

mysqli_real_excape_string($conn,$x);

显然,您需要首先将该变量传递给函数。

现在我得到了这个。你能帮帮我吗?在第8行的/customers/f/4/7/zebratv.se/httpd.www/classes/db.php中调用null上的成员函数get(),第8行是$mysqli=$CONFIG->get(“数据库”)<代码>$CONFIG
未定义。你在哪里定义它?代码里没有。
function sqlesc($x) {
     return "'".mysqli_real_escape_string($x)."'";
}
mysqli_real_excape_string($conn,$x);