Code: Select all
print"
<tr>
<td>
<table cellpadding="0" cellspacing="0" id="sections" width="100%">
<tr>
<td align="left" class="header">
<ul>";
$countys=array(Oakland, Macomb);
$Macomb_Cities=array(Shleby, Utica, Romeo, Washington);
$Oakland_Cities=array(Rochester, Oakland);
foreach($countys as $value){
$result=mysql_query("select * from zapfee_listings where county = '$value'");
$head = mysql_num_rows($result);
if($head > 0){
print "<li>$value</li>";
print "<ul>";
foreach($Oakland_Cities as $value1){
$result1=mysql_query("select * from zapfee_listings where city = '$value1'");
$head1 = mysql_num_rows($result1);
if($head1 > 0){
print "<li>$value1 (".$head1.")</li>";
}
}
print "</ul>";
}
}
print"
</td>
</tr>
</table>
</td>
</tr>
";My second foreach statment is withen a foreach.
If you could use quotes in a foreach for the varible name the secound foreach would look like this...
Code: Select all
foreach("$".$value."_Cities" as "$value1")