Create a Treeview display within MYSQL using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
beginnerphp
Forum Newbie
Posts: 1
Joined: Wed Mar 10, 2010 3:55 pm

Create a Treeview display within MYSQL using PHP

Post by beginnerphp »

Hi, I am an absolute newbie to PHP. My question is quite straight forward and I would like some help and advice with it.
I would like to be able to display data within my MYSQL database in a treeview structure (like Windows explorer).
Since I am just setting up my database, I would like to know how the database should be built and of course, what steps are necessary to display the results in the treeview.
My database structure is quite simple - there is a parent and a child in one file. However the child can be a parent to another child in a separate row. This can continue within limitations for several levels and can be as wide as possible.
I would also like to be able to display this treeview in two formats - one that would have the number of levels set to be a finite limit with another one being the full structure. I would also like to be able to select the details of an entry in the tree by selecting that entry.
This will allow me to organize a scenario such as a recipe or Bill of Material.
Any help that you can provide would be greatly appreciated.
Thanks,
joeyd
Forum Newbie
Posts: 10
Joined: Wed Mar 10, 2010 2:08 pm

Re: Create a Treeview display within MYSQL using PHP

Post by joeyd »

For the first part of your question.... This is a pretty darn good article on managing hierarchical data storage...

http://dev.mysql.com/tech-resources/art ... -data.html

I have yet to try the Nested Set Model. I have always stuck with the Adjacency List Model.
Post Reply