<div class="modal-body">
<?php
$id=$_GET['id'];
$qry="select rel_movies from released_movies where rel_id='$id' ";
$qryr=$con->query($qry);
while($rr=$qryr->fetch_assoc()){
$film=$rr['rel_movies'];
$q="select * from gallery where category='$film'";
$qr=$con->query($q);
while($r=$qr->fetch_assoc()){
?>
<ol class="carousel-indicators">
<li data-target="#lightbox" data-slide-to="0" class="active"></li>
<li data-target="#lightbox" data-slide-to="1"></li>
<li data-target="#lightbox" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="../AbaamAdmin/uploads/<?php echo $r['images'];?>" width="900px" height="500px" >
</div> <!-- /.item active-->
</div> <!-- /.carousel-inner -->
<a class="left carousel-control" href="#lightbox" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#lightbox" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
<?php }} ?>
</div><!-- /.modal-body -->
我试图以幻灯片形式显示bootstrap模式中的数据库中的图像。但是在执行了上面的代码之后,我得到的是,所有图像都出现在模态中,但左右图标都不起作用,而不是用y滚动查看图像。
我无法弄清楚错误。
答案 0 :(得分:1)
答案 1 :(得分:0)
将carousel
置于循环之外。
<ol class="carousel-indicators">
<li data-target="#lightbox" data-slide-to="0" class="active"></li>
<li data-target="#lightbox" data-slide-to="1"></li>
<li data-target="#lightbox" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<?php $counter = 1; ?>
<?php while($r=$qr->fetch_assoc()) { ?>
<div class="item <?php echo ($counter++ == 1) ? 'active' : '' ?>">
<img src="../AbaamAdmin/uploads/<?php echo $r['images'];?>" width="900px" height="500px" >
</div> <!-- /.item active-->
<?php } ?>
</div> <!-- /.carousel-inner -->
<a class="left carousel-control" href="#lightbox" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#lightbox" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>