I have a database of some institutes, with their name and addresses. I want to list the NAMES column wise in HTML table. The HTML table will have 3 columns.

So if the mysql query gives 300 records, it will show the records like every column will have some data, so the column 1 will have records from 1 to 100, column 2 will have records from 101 to 200, and column 3 will have records from 201-300.

here is the current code, but its not working properly:

PHP Code:
$qry $con->select_query("institutes","distinct Names","order by Names");
$num_rows mysql_num_rows($qry);
$per_col ceil($num_rows/3);
$cnt 1;
$no 1;
$data "<tr><td>";
$row mysql_fetch_object($qry))
$cnt $per_col+1)
$data .= "$no$row->Names<br />";
        else if(
$cnt == $per_col+1)
$data .= "</td>";
$data .= "<td>";
$data .= "$no$row->Names<br />";    
$cnt 0;            
$data .= "</tr>"
you can see the results here

Its seems OK, but just look at the top and bottom of column 1 and 2 they are not aligned.