所以我试图回复我的数据库中的一些数据。
<?php
$connect = mysql_connect('xxxxx', 'xxxxx', 'xxxxx');
mysql_select_db("xxxxx", $connect) or die(mysql_error());
$lsql = "SELECT * FROM xxxxxxx ORDER BY Value DESC LIMIT 6";
$lquery = mysql_query($lsql) or die(mysql_error());
while ($lrow = mysql_fetch_array($lquery))
$lrows[] = $lrow;
foreach ($lrows as $lrow){
$ProperBrand = $lrow['ProperBrand'];
$LowerBrand = $lrow['LowerBrand'];
$PageTitle = $lrow['PageTitle'];
$PageH1 = $lrow['PageH1'];
$PageExcerpt = $lrow['PageExcerpt'];
$ContentP1 = $lrow['ContentP1'];
$ContentP2 = $lrow['ContentP2'];
$Image1 = $lrow['Image1'];
$Image2 = $lrow['Image2'];
$Image3 = $lrow['Image3'];
$BrandURL = $lrow['BrandURL'];
echo ('
<div class="col-sm-2">
<img src="'. $Image1 .'" class="top-images-larger">
</div>
');
}
?>
我可以像上面那样回应它,这将正常工作,但我似乎无法弄清楚我将如何使用结构化的引导行来完成此操作。我希望手机上有一个3格的3x3网格,并且如下所示:
<div class="row visible-xs" align="center">
<div class="col-sm-4 padding-bottom">
<img src="/images/brandlogos/logo.png" class="top-images">
<img src="/images/brandlogos/logo.png" class="top-images">
<img src="/images/brandlogos/logo.png" class="top-images">
</div>
<div class="col-sm-4 padding-bottom">
<img src="/images/brandlogos/logo.png" class="top-images">
<img src="/images/brandlogos/logo.png" class="top-images">
<img src="/images/brandlogos/logo.png" class="top-images">
</div>
<div class="col-sm-4 padding-bottom">
<img src="/images/brandlogos/logo.png" class="top-images">
<img src="/images/brandlogos/logo.png" class="top-images">
<img src="/images/brandlogos/logo.png" class="top-images">
</div>
<div class="visible-xs col-sm-4 spacer-t">
<button type="button" class="btn btn-success btn-block">View All Stores</button>
</div>
</div>
如果我像上面的例子中那样回应,它将打破这个“网格”的结构。
提前致谢。
答案 0 :(得分:0)
您好,您可以使用echo来显示带有html表格的网格:
<?php
echo "<table>
<tr>
<th>column1</th>
<th>column2</th>
<th>column3</th>
</tr>
<tr>
<td>".$lrow['yourdata']."</td>
<td>".$lrow['yourdata2']."</td>
<td>".$lrow['yourdata3']."</td>
</tr>
</table>";
?>
希望我帮助过!