st0ked56 Posted March 17, 2013 Share Posted March 17, 2013 Hello, 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. PHP and MySQL <div id="left"> <div class="menu"> <?php $sqlseasons = "SELECT * FROM seasons"; $resultseasons = mysqli_query($dbc, $sqlseasons); while ($row = mysqli_fetch_array($resultseasons)){ $year_id = $row['year_id']; ?> <h3><?php echo $row['seasonyear'] ?></h3> <?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']; ?> <p><a href="#" onclick="displaySeason('<?php echo $teamid ?>')" id="menu_teamname"><?php echo $sqlrow['teamname']; ?></a></p> <?php } mysqli_close(); } mysqli_close(); ?> </div> <button id="team-season">Add Team</button> JQuery $(document).ready(function(){ $('.menu').accordion(); }); Attached is a picture of a menu describing what I am trying to do. Thank you for the help, Mike Quote Link to comment https://forums.phpfreaks.com/topic/275753-jquery-accordion-menu-using-mysql-queries-and-php/ Share on other sites More sharing options...
st0ked56 Posted March 17, 2013 Author Share Posted March 17, 2013 Figured out my problem... The needed to add more divs. Quote Link to comment https://forums.phpfreaks.com/topic/275753-jquery-accordion-menu-using-mysql-queries-and-php/#findComment-1419121 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.