我正在尝试将我的MYSQL数据库中的详细信息显示在这些框中,我的数据库中的最后3个条目,我怎么能回应这个?
<div class="row-fluid">
<ul class="thumbnails">
<li class="span3">
<div class="thumbnail">
<img data-src="holder.js/300x200" alt="300x200" style="width: 300px; height: 200px;">
<div class="caption">
<h3>Thumbnail</h3>
<p>Description 1/p>
<p><a href="#" class="btn btn-danger">Action</a> <a href="#" class="btn">Action</a></p>
</div>
</div>
</li>
<li class="span3">
<div class="thumbnail">
<img data-src="holder.js/300x200" alt="300x200" style="width: 300px; height: 200px;" >
<div class="caption">
<h3>Thumbnail label</h3>
<p>Desc 2.</p>
<p><a href="#" class="btn btn-danger">Action</a> <a href="#" class="btn">Action</a></p>
</div>
</div>
</li>
</ul>
</div>
答案 0 :(得分:2)
根本没有看到任何代码,基本思路如下:
<div class="row-fluid">
<ul class="thumbnails">
<?php while($rows = mysql_fetch_array($query)) { ?>
<li class="span3">
<div class="thumbnail">
<img data-src="holder.js/300x200" alt="300x200" style="width: 300px; height: 200px;">
<div class="caption">
<h3><?php echo $rows['title']; ?></h3>
<p><?php echo $rows['description']; ?></p>
<p> <a href="#" class="btn btn-danger">Action</a> <a href="#" class="btn">Action</a></p>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>