I have managed to output the results in columns. I have nearly cracked it, but the part that is really stumping me here is being able to close the table properly at the end of while loop.
Any ideas what I am doing wrong here. It works fine apart from when the final result is outputted the code ends in <tr></tr></table>
// Output results in columns
echo "<table border=1 align=center><tr>";
$number_of_cols = 0;
// Request results from tables
$result = mysql_query("SELECT * FROM names");
while ( $row = mysql_fetch_array($result) )
{
// increment the counter
$number_of_cols++;
echo "<td width=\"200\">". $row['name'] ."</td>";
if ($number_of_cols == 2)
{
echo"<tr>";
$number_of_cols=0;
}
}
echo"</tr></table>";