我下面的图片代码是这样的:
<div class="container">
<div class="row">
<div class="col-md-4 col-xs-6">
<img src="images/1.jpg" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-xs-6">
<img src="images/1.jpg" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-xs-6">
<img src="images/1.jpg" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-xs-6">
<img src="images/1.jpg" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-xs-6">
<img src="images/1.jpg" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-xs-6">
<img src="images/1.jpg" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-xs-6">
<img src="images/1.jpg" class="img-responsive img-thumbnail">
</div>
</div>
</div>
如果没有从数据库中调用图像,我认为可以这样做。所以我的问题是,如果我在数据库(MySQL)中有几个图像,并且想要像在图片中那样调用并显示它,除了重复一遍又重复相同的代码之外,显示它们的有效方法是什么。我正在使用引导程序3.3.7。初学者在这里,真的很感谢一些指导,谢谢。
答案 0 :(得分:2)
<div class="container">
<div class="row">
<?php
include('conexion.php');
$query = "SELECT * from your_tables";
$result = $mysqli->query($query);
while($row = $result->fetch_array()){
echo ' <div class="col-md-4 col-xs-6">
<img src="'.$row["image"].'" class="img-responsive img-thumbnail">
</div>';
} <?
</div>
</div>