求解? 为什么用循环语句从数据库里循环输出数据,如果数据库里相应的字段没有付值就输出空白,但为什么对应的表格也没有输出。如图:,怎样才能把表格完整输出。求个位老师帮忙! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 预览结果是:代码是:<?php include("conn/conn.php"); //包含conn.php文件 $select=mysql_query("select * from lt_send limit ".($page-1)*$pagesize.",$pagesize"); //查询数据 while($row=mysql_fetch_array($select)){ //循环输出查询内容?> <tr> <td height="40"><span class="STYLE1"> <input name="<?php echo $row[lt_send_id];?>" type="checkbox" value="<?php echo $myrow[tb_send_id];?>" /> </span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_id];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_subject];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_user];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_date];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_distillate];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_hotspot];?></span></td> </tr><?php } //结束循环?> 这是全部代码? 没有看到<table>标签。 全部代码:<body><?php include("conn/conn.php"); $sql=mysql_query("select count(*) as total from lt_send ",$conn); $info=mysql_fetch_array($sql); $total=$info[total]; if($total==0) { echo "本站暂无记录!"; } else { $pagesize=8; if ($total<=$pagesize){ $pagecount=1; } if(($total%$pagesize)!=0){ $pagecount=intval($total/$pagesize)+1; }else{ $pagecount=$total/$pagesize; } if(($_GET[page])==""){ $page=1; }else{ $page=intval($_GET[page]); } $sql1=mysql_query("select * from lt_send order by lt_send_id desc limit ".($page-1)*$pagesize.",$pagesize",$conn);?><form id="form1" name="form1" method="post" action="bbs_update_ok.php"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="32" background="images/right_line.gif"> 您现在的位置:校园馨浪网站后台管理系统 > 帖子管理</td> </tr> <tr> <td height="32" background="images/right_top.gif"> </td> </tr> <tr> <td height="488" align="center" valign="top" background="images/right_middle.gif"><table width="600" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="140" height="35">选项</td> <td width="49">ID</td> <td width="58" height="35">贴子主题</td> <td width="51" height="35">发布人</td> <td width="72" height="35">发布时间</td> <td width="105" height="35">精华区</td> <td width="109" height="35">热点区</td> </tr><?php include("conn/conn.php"); //包含conn.php文件 $select=mysql_query("select * from lt_send limit ".($page-1)*$pagesize.",$pagesize"); //查询数据 while($row=mysql_fetch_array($select)){ //循环输出查询内容?> <tr> <td height="40"><span class="STYLE1"> <input name="<?php echo $row[lt_send_id];?>" type="checkbox" value="<?php echo $myrow[tb_send_id];?>" /> </span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_id];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_subject];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_user];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_date];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_distillate];?></span></td> <td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_hotspot];?></span></td> </tr><?php } //结束循环?> <tr> <td height="40"><input name="button" type="button" class="buttoncss" onclick="checkAll(form1,status)" value="全选" /> <input name="button" type="button" class="buttoncss" onclick="switchAll(form1,status)" value="反选" /> <input name="button" type="button" class="buttoncss" onclick="uncheckAll(form1,status)" value="不选" /></td> <td height="40" colspan="4"> </td> <td height="40"><input type="submit" name="Submit" value="精华帖" /> <input type="submit" name="Submit3" value="取消" /></td> <td height="40"><input type="submit" name="Submit2" value="热门帖" /> <input type="submit" name="Submit4" value="取消" /></td> </tr> </table> <table width="600" border="0" cellpadding="0" cellspacing="0"> <tr> <td>本站共有公告 <?php echo $total; ?> 条 每页显示 <?php echo $pagesize;?> 条 第 <?php echo $page;?> 页/共 <?php echo $pagecount; ?> 页<?php if($page>=2) { ?><a href="bbs_update.php?id=<?php echo $id;?>&page=1" title="首页"><font face="webdings"> 9 </font></a> <a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $page-1;?>" title="前一页"><font face="webdings"> 7 </font></a><?php } if($pagecount<=4){ for($i=1;$i<=$pagecount;$i++){ ?><a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $i;?>"><?php echo $i;?></a><?php } }else{ for($i=1;$i<=4;$i++){ ?><a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $i;?>"><?php echo $i;?></a><?php }?><a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $page-1;?>" title="后一页"><font face="webdings"> 8 </font></a> <a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $pagecount;?>" title="尾页"><font face="webdings"> : </font></a><?php }?></td> </tr> </table> <p> </p></td> </tr> <tr> <td height="32" background="images/right_bottom.gif"> </td> </tr></table><?php }?></form></body> 可能是table嵌套有问题。你用firebug看看。 $row[lt_send_id],这里面的字段名不需引号? 浏览器对表格的解析可能有错误.当你的表格内没有内容的时候可能有些样式不起作用.具体为什么我也不太清楚,你可以对每个为空的值进行替换.或者在表格里面嵌套的PHP中即使为空也输出一个&NBSP来占位.希望我的解答能够帮到你.以前好像也遇到了类似的情况. 我想你的while循环 while($row=mysql_fetch_array($select)){ //循环输出查询内容 一开始就报false, 循环中的内容就不会输出吧。 你看看网页的源文件就知道了 请老师再帮忙看看,firefox平时没有用过,预览结果本应该是:但用firefox预览就变成: 如何判断返页面404? 请问个函数问题 php与mysql的编码问题 关于setcookie..求教 郁闷,再开个高分贴,详细说下URL取值的问题 知道哪里有php连IMAP邮件服务器的教程吗?? 急急急,散分求救啊 header已经发送,为什么还是返回false 求一个正则表达式,超级简单!!! php 怎么同时输出 MySQL表的字段和值 加入新字段问题,请大侠指教 如何实现网站的单向登录
<?php
include("conn/conn.php"); //包含conn.php文件
$select=mysql_query("select * from lt_send limit ".($page-1)*$pagesize.",$pagesize"); //查询数据
while($row=mysql_fetch_array($select)){ //循环输出查询内容
?> <tr>
<td height="40"><span class="STYLE1">
<input name="<?php echo $row[lt_send_id];?>" type="checkbox" value="<?php echo $myrow[tb_send_id];?>" />
</span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_id];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_subject];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_user];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_date];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_distillate];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_hotspot];?></span></td>
</tr>
<?php
} //结束循环
?>
<body>
<?php
include("conn/conn.php");
$sql=mysql_query("select count(*) as total from lt_send ",$conn);
$info=mysql_fetch_array($sql);
$total=$info[total];
if($total==0)
{
echo "本站暂无记录!";
}
else
{
$pagesize=8;
if ($total<=$pagesize){
$pagecount=1;
}
if(($total%$pagesize)!=0){
$pagecount=intval($total/$pagesize)+1;
}else{
$pagecount=$total/$pagesize;
}
if(($_GET[page])==""){
$page=1;
}else{
$page=intval($_GET[page]);
}
$sql1=mysql_query("select * from lt_send order by lt_send_id desc limit ".($page-1)*$pagesize.",$pagesize",$conn);
?><form id="form1" name="form1" method="post" action="bbs_update_ok.php">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="32" background="images/right_line.gif"> 您现在的位置:校园馨浪网站后台管理系统 > 帖子管理</td>
</tr>
<tr>
<td height="32" background="images/right_top.gif"> </td>
</tr>
<tr>
<td height="488" align="center" valign="top" background="images/right_middle.gif">
<table width="600" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="140" height="35">选项</td>
<td width="49">ID</td>
<td width="58" height="35">贴子主题</td>
<td width="51" height="35">发布人</td>
<td width="72" height="35">发布时间</td>
<td width="105" height="35">精华区</td>
<td width="109" height="35">热点区</td>
</tr>
<?php
include("conn/conn.php"); //包含conn.php文件
$select=mysql_query("select * from lt_send limit ".($page-1)*$pagesize.",$pagesize"); //查询数据
while($row=mysql_fetch_array($select)){ //循环输出查询内容
?> <tr>
<td height="40"><span class="STYLE1">
<input name="<?php echo $row[lt_send_id];?>" type="checkbox" value="<?php echo $myrow[tb_send_id];?>" />
</span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_id];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_subject];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_user];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_date];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_distillate];?></span></td>
<td height="40"><span class="STYLE1"><?php echo $row[lt_send_type_hotspot];?></span></td>
</tr>
<?php
} //结束循环
?>
<tr>
<td height="40"><input name="button" type="button" class="buttoncss" onclick="checkAll(form1,status)" value="全选" />
<input name="button" type="button" class="buttoncss" onclick="switchAll(form1,status)" value="反选" />
<input name="button" type="button" class="buttoncss" onclick="uncheckAll(form1,status)" value="不选" /></td>
<td height="40" colspan="4"> </td>
<td height="40"><input type="submit" name="Submit" value="精华帖" />
<input type="submit" name="Submit3" value="取消" /></td>
<td height="40"><input type="submit" name="Submit2" value="热门帖" />
<input type="submit" name="Submit4" value="取消" /></td>
</tr>
</table> <table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>本站共有公告
<?php
echo $total;
?>
条 每页显示 <?php echo $pagesize;?> 条 第 <?php echo $page;?> 页/共 <?php echo $pagecount; ?> 页
<?php
if($page>=2)
{
?>
<a href="bbs_update.php?id=<?php echo $id;?>&page=1" title="首页"><font face="webdings"> 9 </font></a> <a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $page-1;?>" title="前一页"><font face="webdings"> 7 </font></a>
<?php
}
if($pagecount<=4){
for($i=1;$i<=$pagecount;$i++){
?>
<a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $i;?>"><?php echo $i;?></a>
<?php
}
}else{
for($i=1;$i<=4;$i++){
?>
<a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $i;?>"><?php echo $i;?></a>
<?php }?>
<a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $page-1;?>" title="后一页"><font face="webdings"> 8 </font></a> <a href="bbs_update.php?id=<?php echo $id;?>&page=<?php echo $pagecount;?>" title="尾页"><font face="webdings"> : </font></a>
<?php }?></td>
</tr>
</table> <p> </p></td>
</tr>
<tr>
<td height="32" background="images/right_bottom.gif"> </td>
</tr>
</table><?php
}
?>
</form>
</body>
但用firefox预览就变成: