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.