Sorry if my title was off, I'm not exactly sure what the technical term of what I'm trying to do is. With that said, what I'm trying to do is build a accordion style menu that populates from a mysql query. The first part of the menu will simply have a list of team names, which will come from a query that selects all team names and builds a menu:
$result = mysql_query("SELECT * FROM SportsByTeam");
<ul class='nav nav-list'>
<?php
while($row = mysql_fetch_array($result))
{
?>
<li>
<a href="<? echo $row['seo_team']?>"> <?php echo $row['team'] ?> </a>
</li>
<?php
} ?>
This works perfectly for the top level of the menu I'm trying to build. What I'm completely stuck on is how to now incorporate the accordion (bottom level) of the menu. What I want to happen is when someone clicks on a team generated by the query above, a list of the players that belong to that team will drop down. To be clear, I'm not so much asking how to create an accordion menu from an html/css standpoint, I'm asking how to create a dynamic accordion menu based on a mysql query. The query I came up with for the this part is:
SELECT PlayerByTeam.team_name AS TeamName, SportsByTeam.seo_team, PlayerByTeam.first_name, PlayerByTeam.last_name
FROM PlayerByTeam
inner join SportsByTeam ON PlayerByTeam.team_name = SportsByTeam.team
But that's as far as I can get. How do I incorporate the results of the two queries into one dynamic menu? That looks like:
<ul>
<li> Team Name 1 </li>
<ul>
<li> Player Name 1 </li>
<li> Player Name 2 </li>
</ul>
<li> Team Name 2 </li>
..etc
</ul>
(I really appreciate all of your help. SO has helped me learn so much. I hope to one day soon be able to give back to the community.)