system multilevel

Here is my problem:

I’m doing a multilevel system, so I enter with my account and register the new user.
Similarly others do.

The problem is when I view the contracts made, let me explain:

          agent1
     agent2     agent3
agent4 agent5     6 agent

Rules:
agent1 sees everything
agent2 sees 4-5
agent sees 3 6

agent2 can not see 3-6
agent3 can not see 4-5

There are now stationary for a long time on this thing.

Thanks for those who want to help me.

hope you’ll find a better solution.

Hero.

[QUOTE=kamer67;23797]Here is my problem:

I’m doing a multilevel system, so I enter with my account and register the new user.
Similarly others do.

The problem is when I view the contracts made, let me explain:

          agent1
     agent2     agent3
agent4 agent5     6 agent

Rules:
agent1 sees everything
agent2 sees 4-5
agent sees 3 6

agent2 can not see 3-6
agent3 can not see 4-5

There are now stationary for a long time on this thing.

Thanks for those who want to help me.[/QUOTE]
Don’t understand it. What pattern rules define what can see every agent?

is a structure tree.
I present a new agent and see my and his contracts and those introduced by him.

I understand. 2 possible aproximation without thinking too much.

Maybe you can have a field called “parent”. If you pesent me, then my parent are your ID (1 for example), those I present parent fields is equal to my ID, and so on.

Then, when you show data, you have to do research on table all records where parent is the user ID, and collect them on a array for example, then other filter with “childs” ID, and again adding this IDs to “our” array.
Then, you can use a “SELECT … IN” against the array to show all records with parent=all parentcodes in array.

Other aprox more easy, is create your own field simulating a tree.
your ID is 1 then. “TreeField” for your agents, are 1-1, 1-2, 1-3…agents for your first agent will be 1-1-1, 1-1-2 and so on.
Then, you just need to filter until the level you need. Ex: Filter under “TreeField” = “1-%” just your “child” agents, and child agents of your child agents (OMG) will match this key. because I, with ID=2, have a structure like 2-1 2-2 2-1-1 and so on… and your first level child for your first child, must match something like 2-1-%, and your contracts can’t be showed to him.

I hope I explained correctly.

  • I need to take a child, errr a drink