I found a script to display output like this
1 2
3 4
5 6
Here is the code:
//set number of columns
$columns = 2;
$num_rows = mysql_num_rows($result);
echo "<Table>";
for($i=0; $i < $num_rows; $i++) {
$row = mysql_fetch_array ($result);
if(i % $columns == 0) {
echo "<tr>";
}
echo"<td>".$row['stuff']."</td>";
if(($i % columns) == ($columns - 1) || ($i + 1) == $num_rows)
{
echo "<tr>";
}
}
echo "</table>";
The problem I have with it is that it doesn't close the <tr> tablerows with </tr>. It only places a <tr> when a new tablerow is needed. This seems to display correctly, but I don't usually write code without closing the tags. I would like to see if that could be fixed.