Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Organizational Chart

Status
Not open for further replies.

vanduzeet

Technical User
Mar 18, 2005
1
US
Hello
How can I create an organizational chart using php?
Similar to a downline view.

EX:
Member 1 has 10 members under him/her (level 1)
Each person on level 2 could have 10 people under them etc..
Using mysql, I know I can create a select statement for the first level/second level (select * where referrerID=xxxx.
But when member 1 wants to view his/her whole downline, how can he/she see all of them?

When it comes to level 3, the referrerID will be the person from level 2, But I also need to have it referring to the level 1 person.

How can I do this?
And how the the org chart be created?

Thank you so much
Terry
 
essentially this is a tree hierarchy. there are lots of examples on the web for plotting such a hierarchy using php with or without javascript.

if you must use a relational database for such a task i guess the best solution is to query the database recursively until you get no rows returned and at each recursion to populate a mutidimensional array. personally i wouldn't bother though: given the nature of a hierarchy i'd use xml or other flatfile format and just live with the tiny amount of non-normalization that would be caused by a member having two reporting lines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top