Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a binary tree for displaying members in Downline. i am creating a site for MLM(Multi-Level MArketing). tree must be dynamically populated from database. is there any help for me.


Thanks in advance


Regards

Lalit
Posted
Updated 9-Nov-18 19:54pm
v2
Comments
VINAY SOROUT 21-Oct-12 3:25am    
hello lalit sir i m a employee in a software company in delhi i m working on my mlm website project i need ur help for this project if you can help me thn please help me
thanks a lot in advance
i didnt get any way to contact you so i m mentioning my mail please give your feed to my mail vinusorout@gmail.com please sir help me if you can...
Member 11350487 6-Feb-15 12:26pm    
same problem is there plz help me how to make MLM down tree?

 
Share this answer
 
<?php
$id='1';
$result=Myfunction($id);
function display($arr)
{
$markup='';
foreach ($arr as $key => $value) {

if($value!=0)
{

$markup.= '
  • '.((is_array($value))?display($value) : $value) .'
  • ';
    }
    else
    {

    $markup.='
  • empty
  • ';

    }

    }
    return "<row>
      ".$markup."
    ";

    }



    function Myfunction($id)
    {
    $sql="SELECT * FROM `tbl_mlm` WHERE `id`='$id'";
    $res=DBExecute($sql,"select");
    if($res)
    {
    $set=$res[0];
    $left=$set['left'];
    $right=$set['right'];
    $name=$set['name_tree'];

    }
    else
    {
    $left=0;
    $right=0;
    $name="not";
    }

    if($left!="0" AND $right!="0" )
    {
    $temp[$name."_left"]=$left;
    $left_arr=Myfunction($left);
    array_push($temp,Myfunction($left));
    $temp[$name."_right"]=$right;
    $right_arr=Myfunction($right);
    array_push($temp,Myfunction($right));
    }
    else
    {
    $temp[$name."_left"]="0";
    $temp[$name."_right"]="0";
    }

    return $temp;
    }
    ?>
     
    Share this answer
     
    Actually i have made binary tree using asp tree view but my tree is showing in vertical way ..........................i want to show my tree in horizontal way....................hw it is possible


    Thanks in advance

    regards

    vibudh
     
    Share this answer
     
    Comments
    PSK_ 31-May-10 7:23am    
    Please update your original question?
    Member 11350487 6-Feb-15 12:32pm    
    will u please help me to make mlm downline tree?

    This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



    CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900