我正在處理一個應用程序,其中我在自舉中創建了一個滑塊,但在滑塊中有一個幻燈片放映中顯示兩個圖像,因此我寫了一個簡單的select查詢以獲取記錄,但問題是,它顯示同一圖像上的箱子,我不知道我怎麼能在一個循環使用php在一個幻燈片中顯示兩個圖像使用php
在這裏得到下一個數據是代碼
<div class="carousel-inner">
<?php if($blog) : $counter = 0; foreach($blog as $blogs) : $counter++; ?>
<?php if($counter === 1) : ?>
<div class="item active">
<?php else : ?>
<div class="item">
<?php endif; ?>
<div class="row">
<div class="col-md-6">
<div class="panel">
<div class="panel-heading">
<h3>
<a href="#"> <?php echo substr($blogs -> heading, 0, 30); ?> </a> <br> <br> <br>
<p> <?php echo substr($blogs -> description, 0, 300); ?> <br><br>
<a href="#" class="link">Read the full story</a> </p><br>
<img src="<?php echo base_url().$blogs -> image; ?>">
</h3>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel">
<div class="panel-heading">
<h3>
<a href="#"> <?php echo substr($blogs -> heading, 0, 30); ?> </a> <br> <br> <br>
<p> <?php echo substr($blogs -> description, 0, 300); ?> <br><br>
<a href="#" class="link">Read the full story</a> </p><br>
<img src="<?php echo base_url().$blogs -> image; ?>">
</h3>
</div>
</div>
</div>
</div><!--.row-->
</div><!--.item-->
<?php endforeach; endif; ?>
</div><!--.carousel-inner-->
<a data-slide="prev" href="#blog" class="left carousel-control">‹</a>
<a data-slide="next" href="#blog" class="right carousel-control">›</a>
</div><!--.Carousel-->
以上是結果但我希望第二個圖像成爲下一個數據DB
檢查$博客是否有不同的輸出 - >標題vs $博客[1] - >標題 – Danimal
nop它顯示錯誤 –
什麼是您的博客平臺? – Danimal