引导轮播中的mysqli_fetch_array()错误

时间:2018-08-01 16:10:26

标签: php mysqli bootstrap-4 carousel

因此,我正在尝试使轮播与数据库图像一起工作,但是它总是向我返回此错误。 obs:该连接位于include中,连接字符串为“ $ conexao”。 这是te代码:

                                <div class="container">
                 <div class="row">
                 <div id="mycarousel" class="carousel slide" dataride="carousel">

                 <ol class="carousel-indicators">
                 <?php
                 $a = 0;
                 $query = "select * from images";
                 $sql = mysqli_query($conexao,$query);
                 while($row = mysqli_fetch_array($sql))
                 {
                 ?>
                 <li data-target="#mycarousel" data-slide-to="<?php echo
                $a++; ?>"></li>
                 <?php } ?>
                 </ol>

                 <div class="carousel-inner" role="listbox">
                 <?php
                 $queryy = "select * from images";
                 $sqll = mysqli_query($conexao,$queryy);
                 while($img = mysqli_fetch_array($sqll))
                 {
                 ?>
                 <div class="item">
                 <img src="img/<?php echo $img['img']; ?>" class="imgresponsive"
                alt="<?php echo $img['img']; ?>"/>
                 </div>
                 <?php } ?>

                 </div><!--/carousel-inner-->

                 <a href="#mycarousel" class="left carousel-control" dataslide="prev"
                role="button">
                 <i class="fa fa-angle-left prevSlide"></i>
                 </a>
                 <a href="#mycarousel" class="right carousel-control" dataslide="next"
                role="button">
                 <i class="fa fa-angle-right nextSlide"></i>
                 </a> 
                 </div><!--carousel slide-->
                 </div><!-- /row-->
                 </div> 

几乎可以使用,但是轮播让我返回:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\new\production\index.php on line 128

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\new\production\index.php on line 140

有任何线索吗?

0 个答案:

没有答案