<?php
require("conn.php");
$sid=$_GET["id"];
$result=mysql_query("select * from jswo where id='$sid' order by id desc limit 0,1");
$rs=mysql_fetch_array($result);
?>
<DIV class=cont>
<H4 class=daystr><?php echo $rs["a1"]; ?></H4>
<DIV class="text w400 bodyleft">
<?php echo $rs["neirong"]; ?></DIV><IMG align=right
src="<?php echo $rs["img"]; ?>" width=185> </DIV>
<DIV class=bottomy></DIV></DIV>对于以上代码,现在我有个判断,假设上面IMG字段为空,没有内容,那我想实现<IMG align=right
src="<?php echo $rs["img"]; ?>" width=185>这段代码就全部不显示,假设IMG字段有数据时,那<IMG align=right src="<?php echo $rs["img"]; ?>" width=185>这段代码就全部显示出来!请问该怎么写呀?谢谢指导!
if($rs["img"]){
echo '<IMG align=right src="<?php echo $rs["img"]; ?>" width=185>';
}?>
<H4 class=daystr><?=$rs["a1"]=?></H4>
<DIV class="text w400 bodyleft"><?=$rs["neirong"]=?></DIV>
<?=empty($rs["img"])?"":"<IMG align=right src='$rs['img']' width=185>"?>
</DIV>
<DIV class=cont>
<H4 class=daystr><?php echo $rs["a1"]; ?></H4>
<DIV class="text w400 bodyleft">
<?php echo $rs["neirong"]; ?>
//判断$rs["img"]是否为空
<?php if($rs["img"]){ ?>
</DIV><IMG align=right src="<?php echo $rs["img"]; ?>" width=185> </DIV>
<?php } ?>
<DIV class=bottomy></DIV></DIV>