I am using 1x3 matrix to store data in mysql like below:-
ID parentID directID
- 1 0 0 <- This is first ID (So parent is no one),
- 2 1 1
- 3 1 1
- 4 - 3
- 5 - 4
- 6 1 1
- 7 2 1
- 8 2 1
- 9 2 1
10 6 1
11 6 2
I am working on a MLM (multi level marketing) project with 1x3 matrix plan.
As I am using 1x3 matrix structure, I have to find the child which doesnot has 3 child below it, given the top ID as 1 (1 is directID of new ID under which it has joined). The New ID that joins the team has to assign a parentID.