/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function column_display($items,$numcols) { // Number of Rows $output = '<table>'; for ($row=1; $row <= $numrows; $row++) { $cell = 0; $output .= ' <tr>'."\n"; for ($col=1; $col <= $numcols; $col++) { $output .= ' <td>'."\n"; if ($col===1) { $cell += $row; $output .= $items[$cell - 1]->name; } else { $cell += $numrows; $output .= $items[$cell - 1]->name; } $output .= ' </td>'."\n"; } $output .= ' </tr>'."\n"; } $output .= '</table>'; return $output; }