Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get Geneology Tree
- function get_geneology_tree($parent_id=0, $output=""){
- if(empty($parent_id))
- $sql="SELECT *, CONCAT(title,' ',first_name,' ',middle_name,' ',last_name) as full_name
- FROM mlm_user_mst
- WHERE parent_id='$parent_id'
- AND user_type<>'Admin'";
- else
- $sql="SELECT *, CONCAT(title,' ',first_name,' ',middle_name,' ',last_name) as full_name
- FROM mlm_user_mst
- WHERE mlm_user_id_pk='$parent_id'
- AND user_type<>'Admin'";
- $result=mysql_query($sql)or die(mysql_error());
- $num_rows=mysql_num_rows($result);
- if(!empty($num_rows)){
- $output='<ul'.((empty($output))?' id="org"':'').'>';
- $arrres=mysql_fetch_assoc($result);
- $output.='<li>'.$arrres['full_name'];
- if(!empty($arrres['left_id'])){
- $output.=get_geneology_tree($arrres['left_id'], $output);
- }
- if(!empty($arrres['right_id'])){
- $output.=get_geneology_tree($arrres['right_id'], $output);
- }
- $output.='</li>';
- $output.='</ul>';
- }
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement