am currently working on making a php code that would count all users referred directly and indirectly a person. In my mysql database, each user have a column called "upline" which is the referrer.
*P.S The referral system is by referral link by the way.
From the above picture example, the following is seen: A referred B & C; B referred D & E; C referred F & G; G referred H only at the moment.
"A" has total of 6 direct and indirect referrals already (3 from left and 3 from right). assuming, this referral process continues deep down the ladder infinitely,my question is: what php code would count the total current number of referrals under "A" from his right (separately) and left (separately)?. In the little example above, we can easily count his left to be '3' and right to be '4'. I use PHP and MYSQL database (database table is user and i have column for username and upline).
Please, am still a newbie to many php coding, help would be much appreciated, thanks.