动态页面与旋转木马,图像

woobm2wo  于 2021-06-17  发布在  Mysql
关注(0)|答案(1)|浏览(329)

我想做一个动态页面,现在我有一个数据库,在那个数据库中只有图像被插入,现在我可以获取图像和视频,但我有另一个图像被插入,我想把它插入到旋转木马我怎么做?
这是我的数据库

我已经拿到了 id 1 但剩下的图像来自 id 2-3 不在传送带中提取。我只想在传送带上取剩下的图像。我该怎么做谢谢。

<?php
  $data = mysqli_query($con,"SELECT * FROM pax_safeties WHERE id='1'");
    $count = mysqli_num_rows($data);
    if ($count != 0) {
      while($row = mysqli_fetch_array($data)) {
         echo '<div class="tab-pane" id="tabs-5" role="tabpanel"><br>
<div class="container-fluid">
<div class="row">
<div class="col-6 col-md-6">
<a data-toggle="modal" data-target="#basicExample" target="_blank">

<img src="images/pal/'.$row['paxsafety_image'].'" width="100%">

<div class="modal fade" id="basicExample" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog" role="document">
  <div class="modal-content">

<!--------------------CAROUSEL INSERT IMAGES WITH NULL VALUES  ---------------------------------------------------------------------------->

   <div id="carousel-example-11z" class="carousel slide carousel-fade" data-ride="carousel">
    <ol class="carousel-indicators">
     <li data-target="#carousel-example-11z" data-slide-to="0" class="active"></li>
     <li data-target="#carousel-example-11z" data-slide-to="1"></li>
    </ol>
    <div class="carousel-inner" role="listbox">
     <div class="carousel-item active">
      <img class="d-block w-100" src="images/pal/safety.jpg" alt="First slide">
     </div>

    </div>
    <a class="carousel-control-prev" href="#carousel-example-11z" role="button" data-slide="prev">
     <span class="carousel-control-prev-icon" aria-hidden="true"></span>
     <span class="sr-only">Previous</span>
    </a>
    <a class="carousel-control-next" href="#carousel-example-11z" role="button" data-slide="next">
     <span class="carousel-control-next-icon" aria-hidden="true"></span>
     <span class="sr-only">Next</span>
    </a>
   </div>
<!--------------------END OF CAROUSEL INSERT IMAGES WITH NULL VALUES  ---------------------------------------------------------------------------->
  </div>
 </div>
</div>
</a>
</div>
<div class="col-6 col-md-6">
<img class="watch-video" src="images/pal/safetyvid.jpg" width="100%"> 
  <video oncontextmenu="return false;" class="embed-responsive-item" id="video" allowscriptaccess="always" width="0%" controls controlsList="nodownload">

  <source src="images/pal/'.$row['paxsafety_video'].'" type="video/mp4" width="0%">

  </video>
</div>
</div>
</div>
</div>';
        }

      }
?>
13z8s7eq

13z8s7eq1#

您的查询已完成 WHERE id='1' 所以它只能获取图像和视频。如果你想得到更多的结果,你需要改变这一点;或者删除它以获取所有结果,或者类似的操作

WHERE id IN (1, 2, 3)

$data = mysqli_query($con,"SELECT * FROM pax_safeties WHERE id IN (1, 2, 3)");

如果要显示所有图像和视频,只需删除 WHERE 条件完全,即。

$data = mysqli_query($con,"SELECT * FROM pax_safeties");

然而,这可能会给你太多的结果在未来,所以你可能会想要一些形式的 WHERE 最终,或可能是 LIMIT 限制返回结果数的子句,例如。

$data = mysqli_query($con,"SELECT * FROM pax_safeties LIMIT 10");

相关问题