2 回答
TA贡献1798条经验 获得超7个赞
使用以下内容更改您的代码条件。
<?php session_start();
include 'db.php';
$id = (int)$_GET['id'];
$sql = "SELECT * FROM tbl_properties WHERE property_id = $id";
$oppointArr =array();
$result = mysqli_query($conn,$sql);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
$oppointArr = $row;
}
}
else
{
echo "0 results";
}
$display = 'block';
if(($oppointArr['property_type'])=='Open-Plots'){
$display = 'none';
}
?>
<input type='hidden' value='<?=$id;?>' name='property_id'>
<div class="property-specs">
<ul class="specs-list">
<li><div class="icon"><span class="flaticon-double-king-size-bed"></span></div> <?php echo $oppointArr['property_type'];?></li>
<li><div class="icon"><span class="flaticon-copy"></span></div> <?php echo $oppointArr['area_sqft'];?> Sqft</li>
<li><div class="icon"><span class="fa fa-compass"></span></div> <?php echo $oppointArr['facing'];?> Facing</li>
<li id="car_parking" style="display:<?php echo $display?>">><div class="icon"><span class="flaticon-private-garage"><?php echo $oppointArr['car_parking'];?></span></div></li>
<li id="total_bathrooms"><div class="icon"><span class="flaticon-vintage-bathtub"></span></div> <?php echo $oppointArr['total_bathrooms'];?> Bathrooms</li>
</ul>
</div>
TA贡献1824条经验 获得超8个赞
<?php
if($oppointArr['property_type']=='Open-Plots'){
echo 'style="display:none;"';
}else{
echo $oppointArr['car_parking'];
}
?>
这种方式更好吗?
- 2 回答
- 0 关注
- 159 浏览
添加回答
举报