I have a site which have normal and paid user. Paid user can earn money by clicking on ads and by referring people.
Both normal and paid user can invite their friends with email.
My table structure is: usrid, name. email, pass, ref_id, premium(booleon)
where ref_id is the usrid of the person through which this user created account.
If B creates through A, and C through B and so on. I want to pay some commission money to A up to level 7 users.
I didn’t create any column for money because i am in doubt how to add money is A when he get referrals or subreferrals(referrals of referral)
How to do that. I can provide more information if require for answer this problem.
if B creates through A, you populate B ref_id with A id., if C creates through B you populate C ref_id with B id. To pay A up to the seven referral, You select 7 B referral in ascending order and pay A commission on that. Just like that and the process continues for other members