警告:mysqli_fetch_array()期望参数1为mysqli_result,对象在 [英] Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in
本文介绍了警告:mysqli_fetch_array()期望参数1为mysqli_result,对象在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试运行此代码时,我遇到了一些问题.
I'm got a little bit problem when I try to run this code.
我的问题出在第32行:
推荐答案
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in
mysqli_fetch_array的第一个参数必须是查询的结果.您正在做的是您正在传递连接(没有任何意义)和查询命令本身.
mysqli_fetch_array's 1st parameter must be a result of a query. what you are doing is you are you are passing the connection(which doesnt makes sense) and the query command itself.
在此处阅读文档: http ://php.net/manual/en/mysqli-result.fetch-array.php
要解决此问题,请先执行查询,然后将结果存储到变量中,然后再获取该变量.
to fix this, execute the query first, then store the result to a variable then later fetch that variable.
$sql = "select * from privinsi";
$result = mysqli_query($connection,$sql);
while($r = mysqli_fetch_array($result)
{
/// your code here
}
这篇关于警告:mysqli_fetch_array()期望参数1为mysqli_result,对象在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文