关于查询数据的显示
…………<?php
if(@$_POST['ckc']=="查"){
if($_POST['bh']!=""){
if (@$cond=="" ){
$cond="编号 like '%" . trim($_POST['bh']) . "%'";
}else{
$cond = $cond ." AND 编号 like '%" . trim($_POST['bh']) . "%'";
}
}
if($_POST['ckbh']!=""){
if (@$cond=="" ){
$cond="出库编号 like '%" . trim($_POST['ckbh']) . "%'";
}else{
$cond = $cond ." AND 出库编号 like '%" . trim($_POST['ckbh']) . "%'";
}
if (@$cond!=""){
$sql="select * from 出库表 where " . $cond;
}
else{
$sql="select * from 出库表";
}
}
$rs=mysql_query(@$sql);
$jlzs = mysql_num_rows($rs);
if($jlzs !=0)
echo"<table border='1' align='center' cellpadding='1' cellspacing='1'>";
echo"<tr>";
echo"<th>编号</th> <th>出库编号</th>";
echo"<th width='42' align='center' bgcolor='#FFFFFF'>修改</th>";
echo"<th width='59' align='center' bgcolor='#FFFFFF'>删除</th>";
echo"</tr>";
?>
<?php
while($rows=mysql_fetch_assoc($rs))
{
?>
<tr>
<td bgcolor="#FFFFFF" align="center"><?php echo $rows["编号"]?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows["出库编号"]?></td>
<td align="center" bgcolor="#FFFFFF"><input name="button" type="button" onClick="location.href='ckxg.php?id=<?php echo $rows["id"]?>'" value="修改" /></td>
<?$id=$rows["id"];?>
<td align="center" bgcolor="#FFFFFF"><input name="button" type="button" onClick="if(confirm('确定要删除吗?')){location.href='del.php?id=<?php echo $id ?>'}" value="删除" /></td>
<?php
}
?>
</table>
<p align="center"><?php echo "记录数为:$jlzs"; ?></p>
<?php
else{ //这句老报错
echo "没有数据";
?>
这个页面我想让它有数据时才输出数据表格,不要先输出表头,我试了好久也不行