就是想用两个for循环:
实现多行4列的形式....显示数据...
没搞定...

解决方案 »

  1.   

    <table border="1">
    <tr>
    <?
    for($i=0;$i<=99;$i++){
    if($i%4){
    echo "";
    }else{
    echo "</tr><tr>";
    }
    ?>
    <td><? echo $i; ?></td>
    <? }?>
    </tr>
    </table>
      

  2.   

    为什么要用两个for?
    <?php
    $arrProducts = array(
    0 => array("ProductName" => "IPod Nano", "ProductID"  =>  "1111", "Title"  =>  "Ipod",  "Url"  =>  "http://www.apple.com.cn"),
    1 => array("ProductName" => "IPod Video White", "ProductID"  =>  "2222", "Title"  =>  "Ipod",  "Url"  =>  "http://www.apple.com.cn"),
    2 => array("ProductName" => "IPod Video Black", "ProductID"  =>  "3333", "Title"  =>  "Ipod",  "Url"  =>  "http://www.apple.com.cn"),
    );
    $nCount = sizeof($arrProducts);
    ?>
    <TABLE border=1>
    <?php
    for($i=0; $i<$nCount; $i++){
    ?>
    <TR>
    <TD><?php echo $arrProducts[$i]["ProductID"];?></TD>
    <TD><?php echo $arrProducts[$i]["ProductName"];?></TD>
    <TD><?php echo $arrProducts[$i]["Url"];?></TD>
    <TD><?php echo $arrProducts[$i]["Title"];?></TD>
    </TR>
    <?php
    }
    ?>
    </TABLE>