Q:

php:How to make hierarchy of 115 levels with the different level access privileges at each level.

How to make hierarchy of 115 levels with the different level access privileges at each level.
The scenario is I want to make a hierarchy(tree) with one root node and under that node there will be three sub nodes. Under each of these three sub nodes there will be three more sub nodes. In this manner the hierarchy extends till the 115th level. The restriction is that root node will have access privileges to view data of all the nodes coming under it till the end of hierarchy. The all other sub nodes within a tree will have access privileges to view the data of the sub nodes coming under them and the data of the subsequent sub nodes coming under them till the end of hierarchy.

A:

You will probably want to reflect such a complex structure in a database, my proposed solution thus is language agnostic.
Create a table such as
Table Nodes: ID, ParentID, Name, Content

where ParentID is a foreign key referencing to the upper level. Root has ParentID = null.
Create another table
Table Node_Rights: NodeID, UserID

where you give access rights to the nodes.
Now you could evaulate the access rights of a user by looping through all the hierarchies, which would effectively take you a LOT of SQL queries. I think you should execute these queries once or each time the users/access rights have changed and save the results in another table. Such as:
Table Transivite_Node_Rights: NodeID, UserID

This table (could as well be in memory) is your cache to make such a large structure feasible.

