|
Posted by frothpoker on 12/18/06 14:07
I suspect the problem the OP is having is that every member of the MLM
scheme (except one obviously) is a child of another record and may be
the parent of one or more records. If you remove someone from the
chain, it is important that their 'down line' is then assigned to their
parent record to ensure that commissions are paid upwards.
The way to manage this is to give every record an upper and lower bound
record ID.
record ID = 999 (Primary Unique)
bound ID = 999
Name = Fred Bloggs
Address =123 Acacia Avenue
Upper bound ID = 999
Lower bound ID = 1004
Freds Controller is Lindsey Jones
record ID = 667 (Primary Unique)
bound ID = 667
Name = Fred Bloggs
Address =123 Acacia Avenue
Upper bound ID = 667
Lower bound ID = 2006
Everyone between bound ID 1000 and 1004 is part of Freds downline,
everyone between 668 and 2006 is part of lindseys downline so you can
immediately tell that Fred is part of Lindseys downline because his
upper and lower bounds lie within hers
If a new person (Joe Smith) joins Fred's operation and reports directly
to Fred then his record ID is autonumbered.
Everyone with a bound ID higher than 1004 gets 1 added to their boundID
value (to make space for Joe Smith
Everyone with an Lower Bound ID > 1004 gets 1 added to their lower
bound ID
Everyone with an upper Bound ID > 1004 gets 1 added to their upper
bound ID (this keeps things in line and moves all the operations down
one record.
Joes upper and lower bounds will be set to the same as his boundID as
he has no downline. Becuause his upper and lower bounds are inside
Freds, he is part of freds downline and also part of lindseys
If Fred now quits, we delete his record from the table and everyone
with a lower bound bigger than 999 is moved up a place (delete one) and
everyone with a bound ID greater than 999 is moved up a place (delete
one). All of Freds downline has now been promoted up a level in the
MLM structure but is still classed as part of Lindseys downline.
Look for nested menus in google and you should find some good functions
for managing the database and navigating the structure.
Navigation:
[Reply to this message]
|