jquery accordion populate headings with records

hi all please can any one help.

i have this accordion jQuery

http://jqueryui.com/demos/accordion/ 

i am looking to try and populate the headings with a result from a php query.

the thing is i need to know how to automatically add new headings to the accordion if lots of results are  found by my php database query.

hope i have explained well. thx for any comments.  
LVL 1
helpchrisplzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PragmatiCoderCommented:
Is the content of the accordion static (hard coded) or dynamic (an AJAX response per se)?
0
helpchrisplzAuthor Commented:
i have a online games league. am letting players create a war / appointment. and on each clan profile this accordion will show the date, name of clans as the heading in the accordion then if the user clicks the heading it will expand and show more information about the league match appointment.

need to add more headings to the accordion if there are loads of upcoming league wars / appointments booked in.
0
helpchrisplzAuthor Commented:
so depending on the amount of records produced by the while loop i need to count them and have that as the number of headings in the accordion and then populate each heading with each record
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

PragmatiCoderCommented:
Ok, i think i got the idea here...

This is based on the basic functionality demo
(http://jqueryui.com/demos/accordion/default.html)
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>jQuery UI Accordion - Default functionality</title>
	<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
	<script src="../../jquery-1.6.2.js"></script>
	<script src="../../ui/jquery.ui.core.js"></script>
	<script src="../../ui/jquery.ui.widget.js"></script>

	<script src="../../ui/jquery.ui.accordion.js"></script>
	<link rel="stylesheet" href="../demos.css">
	<script>
	$(function() {
            $( "#accordion" ).accordion();
	});
	</script>
</head>
<body>

    
<div class="demo">

<div id="accordion">
    <?php 
        $query = "SELECT heading, content FROM table WHERE 1";
        $result = mysql_query($query);
        while($row = mysql_fetch_object($result)){
    ?>
	<h3><a href="#"><?php echo $row->heading;?></a></h3>
	<div>
		<p>
		<?php echo $row->content; ?>
		</p>
	</div>
    <?php } ?>
</div>

</div><!-- End demo -->
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
helpchrisplzAuthor Commented:
ahh looks so simple i understand now. i will test tomorrow as its 3:37 AM here  
0
helpchrisplzAuthor Commented:
thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.