Jump to content

MLM Geneology


moneygrinch

Recommended Posts

Yeah, i did that for sure.

I can pull the records of all the people in 1 level of the downline.

 

That was the easy part.

 

The issue is going that next level down.

 

Example:  Level 1 has only 1 parent.  So there may be say 5 subs.  Now in order to figure out the subs for these 5 parents I have to SELECT for these 5. 

 

I came up with this but it is poor.  Only the level one works.

// upline figuration
//Level 1
$level_1 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id={$_SESSION['member_id']}");
$level_1a = mysql_fetch_array($level_1);
$upc = mysql_num_rows($level_1);

if($upc > 0){
$upc = $upc;

}else{
$upc ="None";
}
//Level 2
while($level_1a = mysql_fetch_array($level_1, MYSQL_ASSOC)){$level_2 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id=$level_1a[member_id]");
echo $level_2;}

$upc_2 = mysql_num_rows($level_2);
if($upc_2 > 0){
$upc_2 = $upc_2;
}else{
$upc_2 ="None";
}
//while($level_1a = mysql_fetch_array($level_1, MYSQL_ASSOC)){$lvl_1 = $level_1a["member_id"];}
//$level_2 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id=$lvl_1");

What can I do to search for more than one parent at once? 

Link to comment
https://forums.phpfreaks.com/topic/43287-mlm-geneology/#findComment-210213
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.