1

Good Day, TreeView

I am trying to get a correct ordered value from image above, I expect the value would be like below

2,3,4,5,6,7,8,19,9,20,10,11,12,13...18 (the order is from left top to right bottom)

I use this function below

function getUserEmptyLeg($sponsor_id){

        $data_params = array(
            ":placement_id" => $sponsor_id,
            ":status" => "aktif"
        );

        $data = fetchAll("SELECT * FROM users WHERE placement_id =:placement_id AND STATUS=:status", $data_params);
        $new_sponsor_ids = array();
        $member = array();

        foreach($data as $row){
            $member[$row['user_id']] = array(
                "placement_id" => $row['placement_id'],
                "user_id" => $row['user_id'],
                "member_name" => $row['username'],            
                "leg" => $row['leg']
            );

            $new_sponsor_ids[] = $row['user_id'];
        }

        foreach($new_sponsor_ids as $new_sponsor_id){
            $member = array_merge($member, getUserEmptyLeg($new_sponsor_id));
        }
        return $member;
    }

result from above function

2,3,4,5,8,9,10,11,12,13,14,...18,6,7,19,20

but the result from above function didn't output the result as i expected. i am trying as best as possible to make my question clear, im sorry if you all confused when answering it. but i need help from you all, thanks.

Hendry Putra
  • 23
  • 1
  • 6

0 Answers0