Binary tree store in php mysql?

Discussion in 'PHP' started by ramachandran, Mar 12, 2010.

  1. #1
    I am working on a MLM project in which i have more than 30,000 members followed by the root member,i have to store member automatically in binary tree form like

    1 is root
    2 is child of 1
    3 is child of 1

    Then 4 is child of 2
    5 is child of 2

    and so on ......


    I have calculate each members left count and right count in downline, calculation takes 30minutes for 10,000 members, now i have more than 30,000 members it takes more time.... How to avoid this.....

    Here is my table structure

    ID Root MemberID lft rgt
    1 0 1000 8 8
    2 1000 1001 0 7
    3 1001 1002 1 6
    4 1002 1003 2 5


    can any body help me ...
     
    ramachandran, Mar 12, 2010 IP