jquery accordion populate headings with records

hi all please can any one help.

i have this accordion jQuery


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.  
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.

Is the content of the accordion static (hard coded) or dynamic (an AJAX response per se)?
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.
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
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.

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

This is based on the basic functionality demo
<!DOCTYPE html>
<html lang="en">
	<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">
	$(function() {
            $( "#accordion" ).accordion();

<div class="demo">

<div id="accordion">
        $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>
		<?php echo $row->content; ?>
    <?php } ?>

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

Open in new window


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  
helpchrisplzAuthor Commented:
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

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.