<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$str="select * from grade where school_id=$school_id order by id asc";
$result=mysql_query($str,$link_id);
$i=0;
while($rs=mysql_fetch_array($result)){
$grade_id=$rs['id'];
?>
<tr>
<td><div class="kj1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="88%" class="word6"><?=$rs['name']?></td>
<td width="12%"> </td>
</tr>
<tr>
<td colspan="2"><table width="29%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?
$str="select * from class where grade_id=$grade_id order by id asc";
$result=mysql_query($str,$link_id);
$i=0;
while($rs=mysql_fetch_array($result)){
?>
<td><table width="195" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="195" height="30"><a href="firm_list.php?class_id=<?=$rs['id']?>" target="_blank"><?=$rs['name']?></a></td>
</tr>
</table></td><? $i++; if($i%4==0){?>
</tr><? }?><? }?>
</table></td>
</tr>
</table>
</div></td>
</tr><? }?>
</table>
<?
$str="select * from grade where school_id=$school_id order by id asc";
$result=mysql_query($str,$link_id);
$i=0;
while($rs=mysql_fetch_array($result)){
$grade_id=$rs['id'];
?>
<tr>
<td><div class="kj1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="88%" class="word6"><?=$rs['name']?></td>
<td width="12%"> </td>
</tr>
<tr>
<td colspan="2"><table width="29%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?
$str="select * from class where grade_id=$grade_id order by id asc";
$result=mysql_query($str,$link_id);
$i=0;
while($rs=mysql_fetch_array($result)){
?>
<td><table width="195" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="195" height="30"><a href="firm_list.php?class_id=<?=$rs['id']?>" target="_blank"><?=$rs['name']?></a></td>
</tr>
</table></td><? $i++; if($i%4==0){?>
</tr><? }?><? }?>
</table></td>
</tr>
</table>
</div></td>
</tr><? }?>
</table>
AA
a1 a2 a3
BBb1 b2 b3CC
c1 c2 c3可结果就显示上面的AA,下面不循环了~为什么?着急~
内层的将覆盖外层的