3 回答
TA贡献1712条经验 获得超3个赞
现在正在工作。感谢大家的帮助。这是下面的代码。
<div class="container">
<div class="row">
<?php
$select_stmt=$db->prepare("SELECT * FROM galeria ORDER BY id DESC;" ); //sql select query
$select_stmt->execute();
while($row=$select_stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<div class="col-sm-2">
<div class="col-sm-12"><img src="upload/<?php echo $row['image']; ?>" class="imagem" style="height: 100px; weight: 100px;"></div>
<div class="col-sm-12"><a id=""><?php echo $row['texto'];?></a></div>
</div>
<?php
}
?>
</div>
</div>
TA贡献1898条经验 获得超8个赞
您不应该每行创建一个容器。只有一个包含所有行的容器将
您的代码更改为此:
<div class="container">
<?php
$select_stmt=$db->prepare("SELECT * FROM galeria ORDER BY id DESC;" ); //sql select query
$select_stmt->execute();
while($row=$select_stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<div class="row">
<div class="col-sm-12">
<div class="col-sm-6"><img src="upload/<?php echo $row['image']; ?>" class="imagem" style="height: 100px; weight: 100px;"></div>
<div class="col-sm-6"><a id=""><?php echo $row['texto'];?></a></div>
</div>
</div>
<?php
}
?>
</div>
TA贡献1951条经验 获得超3个赞
我的方式
<div class="col-md-3 col-sm-6 col-xs-12">
<a href="/images/<?php echo...
</div>
或者
<div style="float: left; margin-left: 20px; margin-top: 10px;">
<a href="/images/<?php echo...
</div>
添加回答
举报