title: JQuery accordion menu using MySQL queries and PHP
body: <p>I am trying to make an accordion menu using 2 MySQL queries (1 for the header and 1 for the contents) and PHP.  Below is my code PHP and JQuery code, I can't seem to figure out how to make the contents stay inside the headers.  Everything from the MySQL prints out in order.  Any help would be greatly appreciated.</p>
  
  <p>PHP and MySQL</p>
  
  <pre><code>    &lt;div id="left"&gt; 
      &lt;div class="menu"&gt;
      &lt;?php
       $sqlseasons = "SELECT * FROM seasons"; 
      $resultseasons = mysqli_query($dbc, $sqlseasons); 
      while ($row = mysqli_fetch_array($resultseasons)){ 
      $year_id = $row['year_id'];
      ?&gt; 
      &lt;h3&gt;&lt;?php echo $row['seasonyear'] ?&gt;&lt;/h3&gt;
       &lt;?php 
      $sqlteam = "SELECT team.team_id, team.year_id, team.teamname 
      FROM team
       WHERE team.year_id = '$year_id'"; 
      $resultsteam = mysqli_query($dbc, $sqlteam); 
      while ($sqlrow = mysqli_fetch_array($resultsteam)){ 
      $teamid = $sqlrow['team_id']; 
      ?&gt; 
      &lt;p&gt;&lt;a href="#" onclick="displaySeason('&lt;?php echo $teamid ?&gt;')" id="menu_teamname"&gt;&lt;?php echo $sqlrow['teamname']; ?&gt;&lt;/a&gt;&lt;/p&gt;
      &lt;?php 
      } 
      mysqli_close(); } mysqli_close();?&gt;&lt;/div&gt;&lt;button id="team-season"&gt;Add Team&lt;/button&gt;
  </code></pre>
  
  <p>JQuery</p>
  
  <pre><code>$(document).ready(function(){245.      $('.menu').accordion();246.  });
  </code></pre>