I need to be able to output a list of members that is grouped on more than one level. I can handle one level easy enough, but have sub groups under the first level is presenting problems. I've tried various things, but seem to be getting no where.
The output should look something like this:
Fishing
Fly-in-Fishing
City - Member name
City - Member name
Charter Fishing
City - Member name
City - Member name
Golf
City - Member name
City - Member name
Fishing has two sub categories and Golf has none. The code I currently have will produce the main categories of Fishing and Golf, but none of the sub categories under fishing. Everybody ends up in the main category. The sub category name is never listed.
Here is the current code that doesn't work. I think I need a new pair of eyes or two to point out where I'm going wrong.
<?php
$category = "";
$subCategory = "";
echo("<dl><font size=\"2\">");
while($row = mysql_fetch_array($result)){
if($row[ActivityName] != $category){
$category = $row[ActivityName];
$categoryUpper = strtoupper($category);
echo("<dt><br /><a name=\"$category\" class=\"heading\"><b><img src=\"images/bullet.gif\" width=\"12\" height=\"12\" align=\"middle\" alt=\"\"> $categoryUpper</b></a>");
if($row[RegionSubName] != $subCategory && $row[RegionSubName] != ""){
$subCategory = $row[RegionSubName];
echo("<br><span style=\"padding-left:25px; font-size:12px;\"><b>$subCategory</b></span>");
}
}
echo("<br /><dd>$row[City] - <a href=\"Member/$row[SiteName]/index.htm\">$row[MemberName]</a></dd>");
}
echo("</font></dl>");
?>
Thanks for any help.