Huhu,
der Modulo-Operator "%" hilft hier weiter.
Ein Bsp.:
PHP-Code:
/*
Nur zum Test, ein Array mit 30 Werten fuellen...
*/
for ($i = 1 ; $i <31; $i++) {
$row[] = $i;
}
$anz_pro_spalte = 10;
echo '<table border="1">'."n";
for ($i = 0; $i < count($row); $i++) {
/*
Mit Modulo berechnen, wann ein <tr> eingefuegt werden soll...
*/
if ($i % $anz_pro_spalte == 0) {
echo '<tr>'."n";
}
echo '<td>';
echo $row[$i];
echo '</td>'."n";
if ($i % $anz_pro_spalte == $anz_pro_spalte - 1) {
echo '</tr>'."n";
}
}
echo '</table>';
Gruss
chris17
P.S.: @inkvc17 Du hast 'ne nette Zahl in Deinem Nick :-)