警告:mysqli_fetch_array() 期望参数 1 mysqli_result,布尔值在第 404 行的 E:


Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in E:wampwwwDemo 22gallery.php on line 404?

我在页面中给出图像显示PHP代码,而我没有在数据库中插入图像,我发生了此错误,称为

警告:mysqli_fetch_array() 期望参数 1 mysqli_result,布尔值在第 404 行的 E:''wamp''www''Demo 22''gallery.php 中给出?

这是代码:

<?php
include("includes/connect.php");
$select_posts = "select * from album1 where post_id=1";
$run_posts = mysqli_query($con,$select_posts);

while($row=mysqli_fetch_array($run_posts)){
   $post_title = $row['post_title'];
   $post_name =  $row['post_name'];
   $post_image = $row['post_image'];`enter code here`
?>
<p><?php echo $post_title; ?></p>
<a href="gallery1.php"><img class="gallery1" src="image/album1/<?php echo $post_image; ?>"width="160" height="120" ></a>
<p><?php echo $post_name; ?></p>
<?php } ?>

这意味着您之前对mysqli_query调用返回的false而不是对结果集的引用。当 SQL 中存在语法错误时,会发生这种情况。尝试手动运行 SQL 或通过调用 echo mysqli_error($con) 来报告错误。