1
我想用Bootstrap顯示每行SQL查詢的4個圖像結果。我怎樣才能用PHP中的循環來做到這一點?如何使用Bootstrap和SQL查詢連續顯示4列
<div class="row">
<?php
$query = "SELECT * FROM table WHERE nombre='x' ORDER BY nombre";
$consulta = mysql_query($query, $conexion);
while ($data = mysql_fetch_assoc($consulta)) { ?>
<div class='col-md-3 portfolio-item'>
<a href='img/<?php echo $data['imagen']; ?>'>
<img class='img-responsive' src='img/<?php echo $data['imagen']; ?>' alt='<?php echo $data['nombre']; ?>'>
</a>
<div class='panel panel-default'>
<div class='panel-body'>
<?php echo $data['nombre']; ?>
</div>
</div>
</div>
<?php } ?>
</div>