A-A+
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given 解决方法–解决方案

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】
今天在用php7.0版本的时候,XSS平台报错,如下:
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in
出错代码如下:
1 2 3 4 5 | $this->queryId=mysqli_query($this->linkId,$sql); while($row=mysqli_fetch_assoc($this->queryId)){ $this->rows[]=$row; } $this->rowsNum=count($this->rows); |
通过万能的Google找到如下解决方案。
修改后的代码如下:
1 2 3 4 5 6 7 | $this->queryId=mysqli_query($this->linkId,$sql); if($this->queryId){ //多加了一个IF判断 while($row=mysqli_fetch_assoc($this->queryId)){ $this->rows[]=$row; } } $this->rowsNum=count($this->rows); |
如果想查看错误的话可以改为:
$this->queryId=mysqli_query($this->linkId,$sql) or die(mysqli_error($this->linkId));
布施恩德可便相知重
微信扫一扫打赏
支付宝扫一扫打赏