$i=1;
$total=10;
$j=1;
$hh=5;
 while($i<$total)
 {
 echo "<tr>";
 //$rows = $db->fetch_array($rt);
while($j<=$hh)

 $i++;
 $j++;?>
<td align="center" valign="top">88</td> 
  <?php 
  }
  echo "</tr>";
  }
?> 

解决方案 »

  1.   

    //改为for循环:
    $total=10;
    $hh=5;
    for($i = 1; $i < $total; $i ++) {
       echo "<tr>";
       //$rows = $db->fetch_array($rt);
           for($j = 1; $j <= $hh; $j ++) echo '<td align="center" valign="top">88</td>';
      echo "</tr>";
    }
      

  2.   

    奥,谢谢,我试试,不过 为什么while循环 不能行呢?
      

  3.   

    while循环当然也可以,你对$i、$j两个变量的使用有问题,循环体内部的while循环只执行一次:
    $i=1;
    $total=10;
    $hh=5;
    while($i<$total) {
        echo "<tr>";
        //$rows = $db->fetch_array($rt);
        $j = 1;
        while($j<=$hh) {
        $j++;
    ?>
    <td align="center" valign="top">88</td>  
      <?php  
      }
      echo "</tr>";
      $i ++;
      }
    ?>