我有3个像这样的图像区域
<?php echo $row['thumbnail1']; ?>
<?php echo $row['thumbnail2']; ?>
<?php echo $row['thumbnail3']; ?>
如果只有一个exp thumbnail1有图像..
如何展示
以及如果图像1和图2只有数据......
请帮助如何显示php查询,如果只有1或2和3图像上传
这个css风格
<div class="col-xs-12">
<a href="#"><img src="#" class="w-full"></a>
</div>
<!-- IF only 2 image available uploaded USE this -->
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<!-- IF only ALL/3 image available uploaded USE this -->
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
</div>
dsa sdas
答案 0 :(得分:0)
用这个替换你的旧代码(有人编辑了所以我再次重新编写代码):
<?php
if(isset($row['thumbnail1']))
{
?>
<div class="col-xs-12">
<a href="#"><img src="#" class="w-full"></a>
</div>
<?php } ?>
<!-- IF only 2 image available uploaded USE this -->
<?php
if(isset($row['thumbnail2']))
{
?>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<?php } ?>
<!-- IF only ALL/3 image available uploaded USE this -->
<?php
if(isset($row['thumbnail3']))
{
?>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<div class="col-xs-4">
<a href="#"><img src="#" class="w-full"></a>
</div>
<?php } ?>
如果您已经过测试,请告诉我更新。