如果要动态加减,建议使用赋值给数组的办法。
比如说$myarray=mysql_fetch_array($result);

解决方案 »

  1.   


    echo "<table border=1 cellspacing=0 cellpadding=1 width='100%'>";while(list($rowID, $rs) = each($result)){
    if($rowID == 0){//echo table head
    echo "<tr bgcolor='".$GLOBALS['TABLE_HEAD_BGCOLOR']."'>";

    }else{
    echo "<tr>";
    }
    while(list($name, $value) = each($rs)){
    $t_value .= "<td> $value &nbsp;</td>";
    if($rowID == 0){
    $t_header .= "<td> <strong>$name</strong> </td>";
    }
    }
    $t_value = "<td>".($rowID+1+$GLOBALS['POS'])."</td>$t_value";
    if($rowID == 0){
    echo "<td><strong>RowID</strong></td>".$t_header."</tr>\n"."<tr>";
    echo $t_value;
    $t_header = "";
    }else{
    echo $t_value;

    }
    $t_value = "";
    echo "</tr>\n";
    }
    echo "</table>";