找回密码
 免费注册

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in..的处理方式php

[复制链接]
发表于 2023-2-1 09:35:04 | 显示全部楼层 |阅读模式
mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in..的处理方式php

今天调取数据库数据时,一直报一个错:Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in E:\php
后来在网上找了一个很实用的解决方法:
只需要在php文件中写入这样几行代码,便可以“知错就改”了

  1. $result = mysqli_query($con,$sql);   

  2. if (!$result) {
  3.     printf("Error: %s\n", mysqli_error($con));
  4.     exit();
  5. }
复制代码
之后刷新页面查看具体错误信息。

QQ|Archiver|小黑屋|网站地图|深圳市金黑网络技术有限公司 ( 粤ICP备2021124338号|粤公网安备 44030702003689号 )

GMT+8, 2026-8-8 17:07 , Processed in 0.051096 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表