First start with an ID number, this is how far you've gotten through your array! Then decide how many columns you want! You'll have to fill in the gaps yourself, I'm not writing your code for you:
$x represents the ID number!
- Code: Select all
print "<table>\n";
for ($i=0;$i<sizeof($theArray);$i+=$cols) {
print "<tr>\n";
for ($cell=0;$cell<$cols;$cell++) {
if ($item < sizeof($theArray) {
print "<td>".$theArray[$x++]."</td>\n";
$item++} else {
print "<td> </td>\n";
}
}
print "</tr>\n";
}
print "</table>\n";
That's more or less it! You can adjust it to suit your own requirements!
