Bitte Ich mag eine Tabelle erstellen mit PHP, aber ich fand es schwierig, dynamisch neue TABLE ROW
hinzufügen, wenn die Schleife CELL
bereits 4.Dynamische Tabellenzeile erstellen, wenn die Zelle bestimmte Grenze erreicht
Beispiel ist: Der Code unten wird mir diese:
<table>
<td>CELL1</td><td>CELL2</td><td>CELL3</td><td>CELL4 </td><td>CELL5</td><td>CELL6</td><td>CELL7</td><td>CELL8</td>
</table>
Aber ich will, wenn die Zelle 4 ist es eine neue Zeile für andere Elemente
<table>
<tr>
<td>CELL1</td><td>CELL2</td><td>CELL3</td><td>CELL4 </td>
</tr>
<tr>
<td>CELL5</td><td>CELL6</td><td>CELL7</td><td>CELL8</td>
</tr>
</table>
schaffen
Mein Beispiel Code
<?php
$string = 'wifi,pool,cafe,lunch, item1,item2,item3,item4,item5';
$tdlimit = 4;
$converArry = explode(',', $string);
$AddTable = '<table>';
foreach($converArry as $tds){
//if(count_of_cell_is_4_create_tr){$AddTable .= '<tr>';}
$AddTable .= '<td>'.$tds.'</td>';
//if(count_of_cell_is_4_create_tr){$AddTable .= '</tr>';}
}
$AddTable .= '</table>';
?>
Das ist sehr gut, das ist, was ich suche – Peter
Großartig! Froh, dass ich helfen konnte. –