Click to See Complete Forum and Search --> : Display resultset in two columns table alphabetically


amrigo
01-18-2006, 05:15 AM
Hi

I have a list of 110 cityes and i would like to know how to display them in a two column table ordering alphabetically. HJoww can it be done ?
Here is my code displaying just in one column:

$sql = "SELECT * FROM city"
." WHERE txt_region = 3"
." ORDER BY txt_name";

$rs=new query($conn,$sql);
$tot_rows = $rs->numrows();
if($tot_rows>0){
$division = floor($tot_rows/2);
echo $division;
echo "<TABLE>";
$i = 0;
while($rs->getrow()){
$i++;
echo "<TR><TD class='menusolo'>".$rs->field("txt_name")."</TD></TR>";
}
echo "</TABLE>";
}

aaronbdavis
01-18-2006, 08:19 AM
Find out the number of rows and divide by 2. The use two loops -- one for each column -- to display the data