Hi All,
I have this code (below) and what I want to do is print out 10 cities in a column. So if I had 50 cities, there would be 5 columns of 10 cities. This code will print the first column of 10 cities and the rest in the second, no matter how many are left.
Any help is greatly appreciated.
--- Code ----
$count_result = mysql_query("
SELECT
distinct city
FROM
companies where state = '$state'
ORDER BY
city
")
or die("Couldn't execute query.");
$total_rows = mysql_num_rows($count_result);
$min = 0;
$max = 10;
do{
$city_result = mysql_query("
SELECT
distinct city
FROM
companies where state = '$state'
ORDER BY
city
LIMIT
$min, $max
")
or die("Couldn't execute query.");
echo <<<end
<table align="left" cellspacing="10">
end;
while($row = mysql_fetch_array($city_result)){
echo <<<end
<tr>
<td>
<div align="center">
<a href="$PHP_SELF?state=$state&city=$row[city]&action=get_cat">
<font face="Arial, Helvetica, sans-serif" size="2">$row[city]</font>
</a>
</div>
</td>
</tr>
end;
$min++;
$max++;
}
echo <<<end
</table>
end;
} while($total_rows > $max);
echo <<<end
</td>
</tr>
</table>
end;
print_footer();
exit;
}
Gregory D. Fox - Liberty Computer Solutions/Liberty Hosting
(401) 823-5252/Fax: (401) 828-7057
<Greg@LibertyHosting.net><www.LibertyHosting.net>
Web Site Hosting & Design
For ecommerce made easy! Visit: eCommerceCart.com