Einzelnen Beitrag anzeigen
  #6  
Alt 01.06.2004, 18:26:52
chris17 chris17 ist offline
Senior Member
 
Registriert seit: Apr 2003
Alter: 57
Beiträge: 1.236
Huhu,

der Modulo-Operator "%" hilft hier weiter.

Ein Bsp.:
PHP-Code:
/*
    Nur zum Test, ein Array mit 30 Werten fuellen...
*/
for ($i $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 :-)
Mit Zitat antworten