How do I create a matrix tree?
How do I create a 2x2 matrix system where members who register falls under the matrix of their sponsor. Just like an MLM system. [edited] Here's what I really mean. I want to create a 2x2 matrix - a tree with 2 members on the first level and 4 members on the second level. At the top of the tree is member A. When new member registers with his referral link, a code will be run to check if his first level (2 nodes) is filled up with 2 members. If this is false, place the new member in level 1 else check if his second level(4 nodes) is filled up with 4 members. If this is false, place the new member in level 2 else search the database level by level for member A's referrals whose first level (2 nodes) aren't filled up yet and register the new member under such member (spillover). I know a loop will be used here and an increment operator but I don't really know how to go about it.