如何循环依赖<td>在表上

I have problem with looping in table. i want to loop a <td>, when it reach 10 , it build <tr> automatically. Here my code:

$sd=mysql_query("SELECT a.*,b.* FROM surat_jalan a inner join packing_list b on a.id_surat = b.identitas_packing WHERE b.identitas_packing = '$ben[id_surat]' ORDER BY netto_packing ASC"); 
while($pack=mysql_fetch_array($sd)){
    $komapack = number_format($pack['netto_packing'],2);
    echo"<td>$komapack</td>"; 
}

I am stuck on here and don't know what to do but I know how to use mod but " don't know how to loop it.

You can use a counter.

$i = 0;
echo "<tr>";
while($pack=mysql_fetch_array($sd)){
    $komapack = number_format($pack['netto_packing'],2);
    echo"<td>$komapack</td>"; 
    $i++;
    if($i % 10 == 0) // check
       echo "</tr><tr>";
}
echo "</tr>";