Build Tree Structure with values from database

Build Tree Structure with values from database

Hi all,

Sorry if this is a wrong place to post. I am a new Fan of JQUERY, and now I am having an issue in building the JQTREE,
I want to build something like a foldable tree using Jquery.
But the problem is I am getting the values from a Database.

My database structure is
ID--PID----NAME---------NUMBER---------ROLE
-------------------------------------------------------------
1--0---------John----------1234-------------Manager
2--1--------Peter-----------2333------------Analyst
3--2--------Andrew--------4434------------Clerk
4--0-------james-------------8976-----------Manager
5--4-------Robin-------------6543-----------analyst
6--0-------David-------------9876-----------Manager
-------------------------------------------------------------
the structure that I want is initially when I open the page:
--NAME---------NUMBER---------ROLE
-------------------------------------------------------
+John----------1234--------------Manager
+James---------8976-------------Manager
+David----------9876-------------Manager
-------------------------------------------------------------
Look at the managers, analysts and clerks, they are folded(hidden) first.
Now when I expand the manager JOHN, it should look like

--NAME---------NUMBER---------ROLE
-------------------------------------------------------------
-John----------1234--------------Manager
  •    -Peter-----------2333------------Analyst
  •       -  Andrew--------4434------------Clerk
+James---------8976-------------Manager
+David----------9876-------------Manager


It doesn't matter to me which ever database I use(I free to use any database structure like SQL,MYSQL,ORACLE), any scripting language, but my ONLY concern is to use JQUERY.

Can any body please help me, how to do this.