Accordion menu from sql db (load on click)

Accordion menu from sql db (load on click)

Hi, let me start off by saying that I am new to jquery and javascript. I have some experience in other languages though. I've searched google for a couple of hours but nothing seems to fit with what I need to do.

I had some code to load the full contents of the db table to the page at loadtime. This, however, was too much to load at one time (over 150MB). So I need a way to, on click of a menu header, load all the children of that parent.

The database is actually a list of the files on a hard drive, so the database structure is as follows:

id, parentdir, name, isdir, dirid

id is a primary, auto-incrementing key. parentdir is the dir directly above name (could be a dir or file). name is the name of the file or directory ("windows", for example). isdir is a boolean for if name is a dir or not. dirid is the id for the dir which contains the files. For example windows and all the files in it have a dirid of 69.

I'm at my wits end with this and could use as much code as possible. (php, css, jquery, html)

If someone can help me figure out some jquery and css code to load data from a mysql db bit by bit into a accordion child on each click, I should be able to come up with the php code.