how to make a multi level referral system in php
I want to make multi level referral system in that if A,B, C,D,E are registered user of a site then B is referred by A and C is referred by C and so on. In my site there is system for earning incentive. I want to show how much money A has earned through B and B through C and likewise.
I want simply show referrals name and their number in A's profile and portion of money earned from each referral.
i have downloaded a script from this site. The demo is here:http://scripts.kunals.com/index.php?.../index&itmid=1
And i have two types of users in my site: normal user and premium user. I want to generate ref id only for premium users. what will be the table structure?