How to get levels?

Hello,

I am working on a mlm script and I am not sure if i am going in the right direction. The mlm script is 3 (width) x 9 (level) based. The design of my database is following:

CREATE TABLE IF NOT EXISTS `members` (
  `memb_id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `memb_pid` mediumint(9) NOT NULL,
  `memb_pos` tinyint(1) NOT NULL,
  `memb_fullname` varchar(50) NOT NULL,
  PRIMARY KEY (`memb_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

Now as per the design its simple enough and i with just memb_pid can add as many members by using the memb_pos (position left, mid or right).

As 1 member can only have 3 sub-members that i have also covered.

Now there are payouts at each different level.

Eg. If member 1 who is on top joins 3 members below him then he gets 200 for each member.

Then if those 3 members join 3x3 = 9 members below them then they each get 200 for each but the 1st top member gets 100 for each member.

How to make this kind of thing ?

Thanks.