mysql - How to calculate MLM User Income points in php -


i'm trying calculate income points mlm network users (i.e).,

i'm having 5 types of kits such rs.0/-, rs.1000/-, rs.2000/-, rs.4000/-, rs.10000/- . once kit purchased unique pin , user id generate each individual kit

if 2 number of 2000/- kit purchased means userid , pin      2000100 539fdda37c435 ,     2000101 5395b0d8b66d1 ..... 

then based on new user sponsor id(sponsor id old user), registration proceed group left , right.

now what's problem while calculating income point of user how can take children user top bottom. i'd strucked in mysql query.

for example., example tree view

now how can each node's value parent node(1) root node(12) dynamic tree in php ?? struck in loop concept.,

thanks in advance.,

database architecture

 id  par lev lef rgt status  wallet userstatus 1   1   1   2   3    1        0       0 2   2   2   4   5    1        0       0 6   3   2   6   7    1        0       0 8   4   3   8   9    1        0       0 9   5   3   10  11   1        0       0 10  6   3   12  13   1        0       0 11  7   3   0   0    1        0       0 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -