SCDNG PELER
Server IP : 144.76.124.212  /  Your IP : 216.73.216.138
Web Server : LiteSpeed
System : Linux l4cp.vnetindia.com 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64
User : rakcha ( 1356)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home5/rakcha/www/user/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home5/rakcha/www/user//get_final_booster_2.php
<?php 



  include("includes/database.php");



       $select_query = "select * from member where booster = '2'";

       $run = mysqli_query($con,$select_query);

       $serial = 1;

       while ($row = mysqli_fetch_array($run)) {

        $s_num = $serial++;

        $member_id = $row['member_id'];

        $title = $row['title'];

        $dob = $row['dob'];

        $name = $row['name'];

        $gender = $row['gender'];

        $address_1 = $row['address_1'];

        $address_2 = $row['address_2'];

        $town_area = $row['town_area'];

        $city_district = $row['city_district'];

        $state = $row['state'];

        $country = $row['country'];

        $pincode = $row['pincode'];

        $mobile_number = $row['mobile_number'];

        $email = $row['email'];

        $aadhaar_card = $row['aadhaar_card'];

        $pan_card = $row['pan_card'];

        $nominee_name = $row['nominee_name'];

        $nominee_relationship = $row['nominee_relationship'];

        $account_name = $row['account_name'];

        $account_number = $row['account_number'];

        $ifsc_code = $row['ifsc_code'];

        $bank_name = $row['bank_name'];

        $branch_name = $row['branch_name'];

        $date_of_join =$row['date_of_join'];

        $member_no = $row['member_no'];

        $user_id = $row['user_id'];

        $booster = $row['booster'];

        

        $password = $row['password'];

        $elite_board = $row['elite_board'];

        $onhold_payment = $row['onhold_payment'];



        $aadhaar_card_image = $row['aadhaar_card_image'];

        $pan_card_image = $row['pan_card_image'];

        $bank_proof_image = $row['bank_proof_image'];

        $document_status = $row['document_status'];

        $activity_level = $row['activity_level'];

        $activity_referral = $row['activity_referral'];

        $activity_date = $row['activity_date'];

        $activity_month = $row['activity_month'];

        $member_fess = $row['member_fess']; 

        $product_eligible = $row['product_eligible'];

        $network_bonus_data = $row['network_bonus']; 

        $current_release_data = $row['current_release'];  

        $select_query_main = "select * from roi_tree where member_no='$member_no' ORDER BY tree_id ASC limit 1";

        $run_main = mysqli_query($con,$select_query_main);

         

         while ($row_main = mysqli_fetch_array($run_main)) {

          $tree_id_main = $row_main['tree_id'];                                    

          $group_number_main = $row_main['group_number'];

          $member_no_main = $row_main['member_no'];

          $user_id_main = $row_main['user_id'];

          $sponsor_no_main = $row_main['sponsor_no'];

          $relation_ship_no_main = $row_main['relation_ship_no'];

          $level_no_main = $row_main['level_no'];

          $x_position_main = $row_main['x_position']+1;

          $y_position_main = $row_main['y_position'];

          $roi_amount_main = $row_main['roi_amount'];

          $roi_status_main = $row_main['roi_status'];

          $product_amount_main = $row_main['product_amount'];

          $total_bv_main = $row_main['total_bv'];

          }



          if ($member_no == '024') {

            $extra_amount_bv = 0;

          }

          else {

            $extra_amount_bv = 0;

          }







          if ($roi_status_main == 0) {

             $personal_pv_join_1 = $roi_amount_main;

          }

          else {

            $personal_pv_join_1 = 0;

          }



          $personal_pv_join = $personal_pv_join_1+$extra_amount_bv;







          



        $select_query_total_team_pv = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main}%'";

          $run_total_team_pv = mysqli_query($con,$select_query_total_team_pv);

          while($row_total_team_pv = mysqli_fetch_array($run_total_team_pv)){

                $total_team_pv_1 = $row_total_team_pv['SUM(roi_amount)'];

                

          }



          //products

  



          





          $arr1_10a_pro = array();

          $select_query_findempty_pay_10a_pro = "select * from product_member where member_no = '$member_no_main'";

          $run_findempty_pay_10a_pro = mysqli_query($con,$select_query_findempty_pay_10a_pro);

          while ($row_findempty_pay_10a_pro = mysqli_fetch_array($run_findempty_pay_10a_pro)) {

           $arr1_10a_pro[] = $row_findempty_pay_10a_pro['used_no'];

          }



          //get_product_bv



          $select_query_per_product_x1_10a = "select SUM(product_amount) from product_tree where member_no='$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).")";

          $run_per_product_x1_10a = mysqli_query($con,$select_query_per_product_x1_10a);

          while($row_per_product_x1_10a = mysqli_fetch_array($run_per_product_x1_10a)){

                $p_per_product_x1_10a = $row_per_product_x1_10a['SUM(product_amount)'];

          }



          $select_query_cur_product_x1_10a = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main}%' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_cur_product_x1_10a = mysqli_query($con,$select_query_cur_product_x1_10a);

          while($row_cur_product_x1_10a = mysqli_fetch_array($run_cur_product_x1_10a)){

                $p_cur_product_x1_10a = $row_cur_product_x1_10a['SUM(product_amount)'];

          }

          



          $select_query_product_x1_10a = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main}%'";

          $run_product_x1_10a = mysqli_query($con,$select_query_product_x1_10a);

          while($row_product_x1_10a = mysqli_fetch_array($run_product_x1_10a)){

                $p_product_x1_10a = $row_product_x1_10a['SUM(product_amount)'];

          }



          //get_product_bv



          $total_team_pv = $total_team_pv_1+$p_product_x1_10a+$extra_amount_bv;



          //products







        $arr1 = array();

        $select_query_findempty_pay = "select * from roi_member where member_no = '$member_no_main'";

        $run_findempty_pay = mysqli_query($con,$select_query_findempty_pay);

        while ($row_findempty_pay = mysqli_fetch_array($run_findempty_pay)) {

         $arr1[] = $row_findempty_pay['used_no'];

        }



        $select_query_third_level_team = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

              $run_third_level_team = mysqli_query($con,$select_query_third_level_team);

              while($row_third_level_team = mysqli_fetch_array($run_third_level_team)){

                    $total_single_leg_1 = $row_third_level_team['SUM(roi_amount)'];

                    

              }



          $total_single_leg_current_view = $total_single_leg_1+$personal_pv_join+$p_cur_product_x1_10a;

            





          $select_query_main_1 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='1' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_1 = mysqli_query($con,$select_query_main_1);

          $check_level_1 = mysqli_num_rows($run_main_1);

          while ($row_main_1 = mysqli_fetch_array($run_main_1)) {

          $tree_id_main_1 = $row_main_1['tree_id'];

          $group_number_main_1 = $row_main_1['group_number'];

          $member_no_main_1 = $row_main_1['member_no'];

          $sponsor_no_main_1 = $row_main_1['sponsor_no'];

          $level_no_main_1 = $row_main_1['level_no'];

          $relation_ship_no_main_1 = $row_main_1['relation_ship_no'];

          $x_position_main_1 = $row_main_1['x_position'];

        }



        if ($check_level_1 > 0) {

          



        $select_query_total_x1 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_1}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x1 = mysqli_query($con,$select_query_total_x1);

          while($row_total_x1 = mysqli_fetch_array($run_total_x1)){

                $total_x1 = $row_total_x1['SUM(product_amount)'];

                

          }



          $select_query_total_x1a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_1}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x1a = mysqli_query($con,$select_query_total_x1a);

          while($row_total_x1a = mysqli_fetch_array($run_total_x1a)){

                $total_x1a_1 = $row_total_x1a['SUM(roi_amount)'];

          }



          $select_query_growth_1 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_1}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_1 = mysqli_query($con,$select_query_growth_1);

          $check_level_growth_1 = mysqli_num_rows($run_growth_1);



          if ($check_level_growth_1 == 0) {

             $total_cur_1 = $total_x1a_1+$total_x1;

             $growth_leg_1=0;

          }

          else {

            $total_cur_1 = 0;

            $growth_leg_1=1;

          }



          $total_x1a = $total_x1a_1+$total_x1;



          

        }else {

          $total_x1 =0;

          $total_x1a=0;

          $total_cur_1 = 0;

          $growth_leg_1=0;

        }





          $select_query_main_2 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='2' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_2 = mysqli_query($con,$select_query_main_2);

          $check_level_2 = mysqli_num_rows($run_main_2);

          while ($row_main_2 = mysqli_fetch_array($run_main_2)) {

          $tree_id_main_2 = $row_main_2['tree_id'];

          $group_number_main_2 = $row_main_2['group_number'];

          $member_no_main_2 = $row_main_2['member_no'];

          $sponsor_no_main_2 = $row_main_2['sponsor_no'];

          $level_no_main_2 = $row_main_2['level_no'];

          $relation_ship_no_main_2 = $row_main_2['relation_ship_no'];

          $x_position_main_2 = $row_main_2['x_position'];

        }



        if ($check_level_2 > 0) {



        $select_query_total_x2 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_2}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x2 = mysqli_query($con,$select_query_total_x2);

          while($row_total_x2 = mysqli_fetch_array($run_total_x2)){

                $total_x2 = $row_total_x2['SUM(product_amount)'];

                

          }

          $select_query_total_x2a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_2}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x2a = mysqli_query($con,$select_query_total_x2a);

          while($row_total_x2a = mysqli_fetch_array($run_total_x2a)){

                $total_x2a_1 = $row_total_x2a['SUM(roi_amount)'];

                

          }

          $total_x2a = $total_x2a_1+$total_x2;



          $select_query_growth_2 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_2}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_2 = mysqli_query($con,$select_query_growth_2);

          $check_level_growth_2 = mysqli_num_rows($run_growth_2);



          if ($check_level_growth_2 == 0) {

             $total_cur_2 = $total_x2a_1+$total_x2;

             $growth_leg_2=0;

          }

          else {

            $total_cur_2 = 0;

            $growth_leg_2=1;

          }





        }

        else {

             $total_x2 =0;

             $total_x2a=0;

             $total_cur_2 = 0;

             $growth_leg_2=0;

        }



        $select_query_main_3 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='3' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_3 = mysqli_query($con,$select_query_main_3);

          $check_level_3 = mysqli_num_rows($run_main_3);

          while ($row_main_3 = mysqli_fetch_array($run_main_3)) {

          $tree_id_main_3 = $row_main_3['tree_id'];

          $group_number_main_3 = $row_main_3['group_number'];

          $member_no_main_3 = $row_main_3['member_no'];

          $sponsor_no_main_3 = $row_main_3['sponsor_no'];

          $level_no_main_3 = $row_main_3['level_no'];

          $relation_ship_no_main_3 = $row_main_3['relation_ship_no'];

          $x_position_main_3 = $row_main_3['x_position'];

        }



        if ($check_level_3 > 0) {



        $select_query_total_x3 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_3}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x3 = mysqli_query($con,$select_query_total_x3);

          while($row_total_x3 = mysqli_fetch_array($run_total_x3)){

                $total_x3 = $row_total_x3['SUM(product_amount)'];

                

          }



          $select_query_total_x3a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_3}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x3a = mysqli_query($con,$select_query_total_x3a);

          while($row_total_x3a = mysqli_fetch_array($run_total_x3a)){

                $total_x3a_1 = $row_total_x3a['SUM(roi_amount)'];

                

          }

          $total_x3a = $total_x3a_1+$total_x3;



          $select_query_growth_3 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_3}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_3 = mysqli_query($con,$select_query_growth_3);

          $check_level_growth_3 = mysqli_num_rows($run_growth_3);



          if ($check_level_growth_3 == 0) {

             $total_cur_3 = $total_x3a_1+$total_x3;

             $growth_leg_3=0;

          }

          else {

            $total_cur_3 = 0;

            $growth_leg_3=1;

          }



        }

        else {



          $total_x3 =0;

             $total_x3a=0;

             $total_cur_3 = 0;

             $growth_leg_3=0;



        }





          $select_query_main_4 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='4' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_4 = mysqli_query($con,$select_query_main_4);

          $check_level_4 = mysqli_num_rows($run_main_4);

          while ($row_main_4 = mysqli_fetch_array($run_main_4)) {

          $tree_id_main_4 = $row_main_4['tree_id'];

          $group_number_main_4 = $row_main_4['group_number'];

          $member_no_main_4 = $row_main_4['member_no'];

          $sponsor_no_main_4 = $row_main_4['sponsor_no'];

          $level_no_main_4 = $row_main_4['level_no'];

          $relation_ship_no_main_4 = $row_main_4['relation_ship_no'];

          $x_position_main_4 = $row_main_4['x_position'];

        }



        if ($check_level_4 > 0) {



        $select_query_total_x4 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_4}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x4 = mysqli_query($con,$select_query_total_x4);

          while($row_total_x4 = mysqli_fetch_array($run_total_x4)){

                $total_x4 = $row_total_x4['SUM(product_amount)'];

                

          }



          $select_query_total_x4a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_4}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x4a = mysqli_query($con,$select_query_total_x4a);

          while($row_total_x4a = mysqli_fetch_array($run_total_x4a)){

                $total_x4a_1 = $row_total_x4a['SUM(roi_amount)'];

                

          }

          $total_x4a = $total_x4a_1+$total_x4;



          $select_query_growth_4 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_4}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_4 = mysqli_query($con,$select_query_growth_4);

          $check_level_growth_4 = mysqli_num_rows($run_growth_4);



          if ($check_level_growth_4 == 0) {

             $total_cur_4 = $total_x4a_1+$total_x4;

             $growth_leg_4=0;

          }

          else {

            $total_cur_4 = 0;

            $growth_leg_4=1;

          }



        }else {



          $total_x4 =0;

             $total_x4a=0;

             $total_cur_4 = 0;

             $growth_leg_4=0;



        }





          $select_query_main_5 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='5' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_5 = mysqli_query($con,$select_query_main_5);

          $check_level_5 = mysqli_num_rows($run_main_5);

          while ($row_main_5 = mysqli_fetch_array($run_main_5)) {

          $tree_id_main_5 = $row_main_5['tree_id'];

          $group_number_main_5 = $row_main_5['group_number'];

          $member_no_main_5 = $row_main_5['member_no'];

          $sponsor_no_main_5 = $row_main_5['sponsor_no'];

          $level_no_main_5 = $row_main_5['level_no'];

          $relation_ship_no_main_5 = $row_main_5['relation_ship_no'];

          $x_position_main_5 = $row_main_5['x_position'];

        }



        if ($check_level_5 > 0) {



        $select_query_total_x5 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_5}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x5 = mysqli_query($con,$select_query_total_x5);

          while($row_total_x5 = mysqli_fetch_array($run_total_x5)){

                $total_x5 = $row_total_x5['SUM(product_amount)'];

          }



          $select_query_total_x5a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_5}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x5a = mysqli_query($con,$select_query_total_x5a);

          while($row_total_x5a = mysqli_fetch_array($run_total_x5a)){

                $total_x5a_1 = $row_total_x5a['SUM(roi_amount)'];





                

          }

          $total_x5a = $total_x5a_1+$total_x5;



          $select_query_growth_5 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_5}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_5 = mysqli_query($con,$select_query_growth_5);

          $check_level_growth_5 = mysqli_num_rows($run_growth_5);



          if ($check_level_growth_5 == 0) {

             $total_cur_5 = $total_x5a_1+$total_x5;

             $growth_leg_5=0;

          }

          else {

            $total_cur_5 = 0;

            $growth_leg_5=1;

          }





        }else {



          $total_x5 =0;

             $total_x5a=0;

             $total_cur_5 = 0;

             $growth_leg_5=0;



        }



        $select_query_main_6 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='6' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_6 = mysqli_query($con,$select_query_main_6);

          $check_level_6 = mysqli_num_rows($run_main_6);

          while ($row_main_6 = mysqli_fetch_array($run_main_6)) {

          $tree_id_main_6 = $row_main_6['tree_id'];

          $group_number_main_6 = $row_main_6['group_number'];

          $member_no_main_6 = $row_main_6['member_no'];

          $sponsor_no_main_6 = $row_main_6['sponsor_no'];

          $level_no_main_6 = $row_main_6['level_no'];

          $relation_ship_no_main_6 = $row_main_6['relation_ship_no'];

          $x_position_main_6 = $row_main_6['x_position'];

        }



        if ($check_level_6 > 0) {



        $select_query_total_x6 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_6}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x6 = mysqli_query($con,$select_query_total_x6);

          while($row_total_x6 = mysqli_fetch_array($run_total_x6)){

                $total_x6 = $row_total_x6['SUM(product_amount)'];

          }



          $select_query_total_x6a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_6}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x6a = mysqli_query($con,$select_query_total_x6a);

          while($row_total_x6a = mysqli_fetch_array($run_total_x6a)){

                $total_x6a_1 = $row_total_x6a['SUM(roi_amount)'];





                

          }

          $total_x6a = $total_x6a_1+$total_x6;



          $select_query_growth_6 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_6}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_6 = mysqli_query($con,$select_query_growth_6);

          $check_level_growth_6 = mysqli_num_rows($run_growth_6);



          if ($check_level_growth_6 == 0) {

             $total_cur_6 = $total_x6a_1+$total_x6;

             $growth_leg_6=0;

          }

          else {

            $total_cur_6 = 0;

            $growth_leg_6=1;

          }





        }else {



          $total_x6 =0;

             $total_x6a=0;

             $total_cur_6 = 0;

             $growth_leg_6=0;



        }



        $select_query_main_7 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='7' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_7 = mysqli_query($con,$select_query_main_7);

          $check_level_7 = mysqli_num_rows($run_main_7);

          while ($row_main_7 = mysqli_fetch_array($run_main_7)) {

          $tree_id_main_7 = $row_main_7['tree_id'];

          $group_number_main_7 = $row_main_7['group_number'];

          $member_no_main_7 = $row_main_7['member_no'];

          $sponsor_no_main_7 = $row_main_7['sponsor_no'];

          $level_no_main_7 = $row_main_7['level_no'];

          $relation_ship_no_main_7 = $row_main_7['relation_ship_no'];

          $x_position_main_7 = $row_main_7['x_position'];

        }



        if ($check_level_7 > 0) {



        $select_query_total_x7 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_7}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x7 = mysqli_query($con,$select_query_total_x7);

          while($row_total_x7 = mysqli_fetch_array($run_total_x7)){

                $total_x7 = $row_total_x7['SUM(product_amount)'];

          }



          $select_query_total_x7a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_7}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x7a = mysqli_query($con,$select_query_total_x7a);

          while($row_total_x7a = mysqli_fetch_array($run_total_x7a)){

                $total_x7a_1 = $row_total_x7a['SUM(roi_amount)'];





                

          }

          $total_x7a = $total_x7a_1+$total_x7;





          $select_query_growth_7 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_7}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_7 = mysqli_query($con,$select_query_growth_7);

          $check_level_growth_7 = mysqli_num_rows($run_growth_7);



          if ($check_level_growth_7 == 0) {

             $total_cur_7 = $total_x7a_1+$total_x7;

             $growth_leg_7=0;

          }

          else {

            $total_cur_7 = 0;

            $growth_leg_7=1;

          }





        }else {



          $total_x7 =0;

             $total_x7a=0;

             $total_cur_7 = 0;

             $growth_leg_7=0;



        }



        $select_query_main_8 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='8' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_8 = mysqli_query($con,$select_query_main_8);

          $check_level_8 = mysqli_num_rows($run_main_8);

          while ($row_main_8 = mysqli_fetch_array($run_main_8)) {

          $tree_id_main_8 = $row_main_8['tree_id'];

          $group_number_main_8 = $row_main_8['group_number'];

          $member_no_main_8 = $row_main_8['member_no'];

          $sponsor_no_main_8 = $row_main_8['sponsor_no'];

          $level_no_main_8 = $row_main_8['level_no'];

          $relation_ship_no_main_8 = $row_main_8['relation_ship_no'];

          $x_position_main_8 = $row_main_8['x_position'];

        }



        if ($check_level_8 > 0) {



        $select_query_total_x8 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_8}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x8 = mysqli_query($con,$select_query_total_x8);

          while($row_total_x8 = mysqli_fetch_array($run_total_x8)){

                $total_x8 = $row_total_x8['SUM(product_amount)'];

          }



          $select_query_total_x8a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_8}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x8a = mysqli_query($con,$select_query_total_x8a);

          while($row_total_x8a = mysqli_fetch_array($run_total_x8a)){

                $total_x8a_1 = $row_total_x8a['SUM(roi_amount)'];





                

          }

          $total_x8a = $total_x8a_1+$total_x8;



          $select_query_growth_8 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_8}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_8 = mysqli_query($con,$select_query_growth_8);

          $check_level_growth_8 = mysqli_num_rows($run_growth_8);



          if ($check_level_growth_8 == 0) {

             $total_cur_8 = $total_x8a_1+$total_x8;

             $growth_leg_8=0;

          }

          else {

            $total_cur_8 = 0;

            $growth_leg_8=1;

          }





        }else {



          $total_x8 =0;

             $total_x8a=0;

             $total_cur_8 = 0;

             $growth_leg_8=0;



        }



        $select_query_main_9 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='9' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_9 = mysqli_query($con,$select_query_main_9);

          $check_level_9 = mysqli_num_rows($run_main_9);

          while ($row_main_9 = mysqli_fetch_array($run_main_9)) {

          $tree_id_main_9 = $row_main_9['tree_id'];

          $group_number_main_9 = $row_main_9['group_number'];

          $member_no_main_9 = $row_main_9['member_no'];

          $sponsor_no_main_9 = $row_main_9['sponsor_no'];

          $level_no_main_9 = $row_main_9['level_no'];

          $relation_ship_no_main_9 = $row_main_9['relation_ship_no'];

          $x_position_main_9 = $row_main_9['x_position'];

        }



        if ($check_level_9 > 0) {



        $select_query_total_x9 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_9}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x9 = mysqli_query($con,$select_query_total_x9);

          while($row_total_x9 = mysqli_fetch_array($run_total_x9)){

                $total_x9 = $row_total_x9['SUM(product_amount)'];

          }



          $select_query_total_x9a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_9}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x9a = mysqli_query($con,$select_query_total_x9a);

          while($row_total_x9a = mysqli_fetch_array($run_total_x9a)){

                $total_x9a_1 = $row_total_x9a['SUM(roi_amount)'];





                

          }

          $total_x9a = $total_x9a_1+$total_x9;



          $select_query_growth_9 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_9}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_9 = mysqli_query($con,$select_query_growth_9);

          $check_level_growth_9 = mysqli_num_rows($run_growth_9);



          if ($check_level_growth_9 == 0) {

             $total_cur_9 = $total_x9a_1+$total_x9;

             $growth_leg_9=0;

          }

          else {

            $total_cur_9 = 0;

            $growth_leg_9=1;

          }







        }else {



          $total_x9 =0;

             $total_x9a=0;

             $total_cur_9 = 0;

             $growth_leg_9=0;



        }



        $select_query_main_10 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='10' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_10 = mysqli_query($con,$select_query_main_10);

          $check_level_10 = mysqli_num_rows($run_main_10);

          while ($row_main_10 = mysqli_fetch_array($run_main_10)) {

          $tree_id_main_10 = $row_main_10['tree_id'];

          $group_number_main_10 = $row_main_10['group_number'];

          $member_no_main_10 = $row_main_10['member_no'];

          $sponsor_no_main_10 = $row_main_10['sponsor_no'];

          $level_no_main_10 = $row_main_10['level_no'];

          $relation_ship_no_main_10 = $row_main_10['relation_ship_no'];

          $x_position_main_10 = $row_main_10['x_position'];

        }



        if ($check_level_10 > 0) {



        $select_query_total_x10 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_10}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x10 = mysqli_query($con,$select_query_total_x10);

          while($row_total_x10 = mysqli_fetch_array($run_total_x10)){

                $total_x10 = $row_total_x10['SUM(product_amount)'];

          }



          $select_query_total_x10a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_10}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x10a = mysqli_query($con,$select_query_total_x10a);

          while($row_total_x10a = mysqli_fetch_array($run_total_x10a)){

                $total_x10a_1 = $row_total_x10a['SUM(roi_amount)'];





                

          }

          $total_x10a = $total_x10a_1+$total_x10;



          $select_query_growth_10 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_10}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_10 = mysqli_query($con,$select_query_growth_10);

          $check_level_growth_10 = mysqli_num_rows($run_growth_10);



          if ($check_level_growth_10 == 0) {

             $total_cur_10 = $total_x10a_1+$total_x10;

             $growth_leg_10=0;

          }

          else {

            $total_cur_10 = 0;

            $growth_leg_10=1;

          }





        }else {



          $total_x10 =0;

             $total_x10a=0;

             $total_cur_10 = 0;

             $growth_leg_10=0;



        }







        $select_query_main_11 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='11' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_11 = mysqli_query($con,$select_query_main_11);

          $check_level_11 = mysqli_num_rows($run_main_11);

          while ($row_main_11 = mysqli_fetch_array($run_main_11)) {

          $tree_id_main_11 = $row_main_11['tree_id'];

          $group_number_main_11 = $row_main_11['group_number'];

          $member_no_main_11 = $row_main_11['member_no'];

          $sponsor_no_main_11 = $row_main_11['sponsor_no'];

          $level_no_main_11 = $row_main_11['level_no'];

          $relation_ship_no_main_11 = $row_main_11['relation_ship_no'];

          $x_position_main_11 = $row_main_11['x_position'];

        }



        if ($check_level_11 > 0) {

          



        $select_query_total_x11 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_11}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x11 = mysqli_query($con,$select_query_total_x11);

          while($row_total_x11 = mysqli_fetch_array($run_total_x11)){

                $total_x11 = $row_total_x11['SUM(product_amount)'];

                

          }



          $select_query_total_x11a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_11}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x11a = mysqli_query($con,$select_query_total_x11a);

          while($row_total_x11a = mysqli_fetch_array($run_total_x11a)){

                $total_x11a_11 = $row_total_x11a['SUM(roi_amount)'];

                

          }

          $total_x11a = $total_x11a_11+$total_x11;



          $select_query_growth_11 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_11}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_11 = mysqli_query($con,$select_query_growth_11);

          $check_level_growth_11 = mysqli_num_rows($run_growth_11);



          if ($check_level_growth_11 == 0) {

             $total_cur_11 = $total_x11a_11+$total_x11;

             $growth_leg_11=0;

          }

          else {

            $total_cur_11 = 0;

            $growth_leg_11=1;

          }





        }else {

          $total_x11 =0;

          $total_x11a=0;

          $total_cur_11 = 0;

          $growth_leg_11=0;

        }





          $select_query_main_12 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='12' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_12 = mysqli_query($con,$select_query_main_12);

          $check_level_12 = mysqli_num_rows($run_main_12);

          while ($row_main_12 = mysqli_fetch_array($run_main_12)) {

          $tree_id_main_12 = $row_main_12['tree_id'];

          $group_number_main_12 = $row_main_12['group_number'];

          $member_no_main_12 = $row_main_12['member_no'];

          $sponsor_no_main_12 = $row_main_12['sponsor_no'];

          $level_no_main_12 = $row_main_12['level_no'];

          $relation_ship_no_main_12 = $row_main_12['relation_ship_no'];

          $x_position_main_12 = $row_main_12['x_position'];

        }



        if ($check_level_12 > 0) {



        $select_query_total_x12 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_12}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x12 = mysqli_query($con,$select_query_total_x12);

          while($row_total_x12 = mysqli_fetch_array($run_total_x12)){

                $total_x12 = $row_total_x12['SUM(product_amount)'];

                

          }

          $select_query_total_x12a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_12}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x12a = mysqli_query($con,$select_query_total_x12a);

          while($row_total_x12a = mysqli_fetch_array($run_total_x12a)){

                $total_x12a_1 = $row_total_x12a['SUM(roi_amount)'];

                

          }

          $total_x12a = $total_x12a_1+$total_x12;



          $select_query_growth_12 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_12}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_12 = mysqli_query($con,$select_query_growth_12);

          $check_level_growth_12 = mysqli_num_rows($run_growth_12);



          if ($check_level_growth_12 == 0) {

             $total_cur_12 = $total_x12a_1+$total_x12;

             $growth_leg_12=0;

          }

          else {

            $total_cur_12 = 0;

            $growth_leg_12=1;

          }



        }

        else {

             $total_x12 =0;

             $total_x12a=0;

             $total_cur_12 = 0;

             $growth_leg_12=0;

        }



        $select_query_main_13 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='13' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_13 = mysqli_query($con,$select_query_main_13);

          $check_level_13 = mysqli_num_rows($run_main_13);

          while ($row_main_13 = mysqli_fetch_array($run_main_13)) {

          $tree_id_main_13 = $row_main_13['tree_id'];

          $group_number_main_13 = $row_main_13['group_number'];

          $member_no_main_13 = $row_main_13['member_no'];

          $sponsor_no_main_13 = $row_main_13['sponsor_no'];

          $level_no_main_13 = $row_main_13['level_no'];

          $relation_ship_no_main_13 = $row_main_13['relation_ship_no'];

          $x_position_main_13 = $row_main_13['x_position'];

        }



        if ($check_level_13 > 0) {



        $select_query_total_x13 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_13}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x13 = mysqli_query($con,$select_query_total_x13);

          while($row_total_x13 = mysqli_fetch_array($run_total_x13)){

                $total_x13 = $row_total_x13['SUM(product_amount)'];

                

          }



          $select_query_total_x13a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_13}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x13a = mysqli_query($con,$select_query_total_x13a);

          while($row_total_x13a = mysqli_fetch_array($run_total_x13a)){

                $total_x13a_1 = $row_total_x13a['SUM(roi_amount)'];

                

          }

          $total_x13a = $total_x13a_1+$total_x13;



          $select_query_growth_13 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_13}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_13 = mysqli_query($con,$select_query_growth_13);

          $check_level_growth_13 = mysqli_num_rows($run_growth_13);



          if ($check_level_growth_13 == 0) {

             $total_cur_13 = $total_x13a_1+$total_x13;

             $growth_leg_13=0;

          }

          else {

            $total_cur_13 = 0;

            $growth_leg_13=1;

          }





        }

        else {



          $total_x13 =0;

             $total_x13a=0;

             $total_cur_13 = 0;

             $growth_leg_13=0;



        }





          $select_query_main_14 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='14' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_14 = mysqli_query($con,$select_query_main_14);

          $check_level_14 = mysqli_num_rows($run_main_14);

          while ($row_main_14 = mysqli_fetch_array($run_main_14)) {

          $tree_id_main_14 = $row_main_14['tree_id'];

          $group_number_main_14 = $row_main_14['group_number'];

          $member_no_main_14 = $row_main_14['member_no'];

          $sponsor_no_main_14 = $row_main_14['sponsor_no'];

          $level_no_main_14 = $row_main_14['level_no'];

          $relation_ship_no_main_14 = $row_main_14['relation_ship_no'];

          $x_position_main_14 = $row_main_14['x_position'];

        }



        if ($check_level_14 > 0) {



        $select_query_total_x14 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_14}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x14 = mysqli_query($con,$select_query_total_x14);

          while($row_total_x14 = mysqli_fetch_array($run_total_x14)){

                $total_x14 = $row_total_x14['SUM(product_amount)'];

                

          }



          $select_query_total_x14a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_14}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x14a = mysqli_query($con,$select_query_total_x14a);

          while($row_total_x14a = mysqli_fetch_array($run_total_x14a)){

                $total_x14a_1 = $row_total_x14a['SUM(roi_amount)'];

                

          }

          $total_x14a = $total_x14a_1+$total_x14;



          $select_query_growth_14 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_14}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_14 = mysqli_query($con,$select_query_growth_14);

          $check_level_growth_14 = mysqli_num_rows($run_growth_14);



          if ($check_level_growth_14 == 0) {

             $total_cur_14 = $total_x14a_1+$total_x14;

             $growth_leg_14=0;

          }

          else {

            $total_cur_14 = 0;

            $growth_leg_14=1;

          }





        }else {



          $total_x14 =0;

             $total_x14a=0;

             $total_cur_14 = 0;

             $growth_leg_14=0;



        }





          $select_query_main_15 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='15' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_15 = mysqli_query($con,$select_query_main_15);

          $check_level_15 = mysqli_num_rows($run_main_15);

          while ($row_main_15 = mysqli_fetch_array($run_main_15)) {

          $tree_id_main_15 = $row_main_15['tree_id'];

          $group_number_main_15 = $row_main_15['group_number'];

          $member_no_main_15 = $row_main_15['member_no'];

          $sponsor_no_main_15 = $row_main_15['sponsor_no'];

          $level_no_main_15 = $row_main_15['level_no'];

          $relation_ship_no_main_15 = $row_main_15['relation_ship_no'];

          $x_position_main_15 = $row_main_15['x_position'];

        }



        if ($check_level_15 > 0) {



        $select_query_total_x15 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_15}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x15 = mysqli_query($con,$select_query_total_x15);

          while($row_total_x15 = mysqli_fetch_array($run_total_x15)){

                $total_x15 = $row_total_x15['SUM(product_amount)'];

          }



          $select_query_total_x15a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_15}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x15a = mysqli_query($con,$select_query_total_x15a);

          while($row_total_x15a = mysqli_fetch_array($run_total_x15a)){

                $total_x15a_1 = $row_total_x15a['SUM(roi_amount)'];





                

          }

          $total_x15a = $total_x15a_1+$total_x15;



          $select_query_growth_15 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_15}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_15 = mysqli_query($con,$select_query_growth_15);

          $check_level_growth_15 = mysqli_num_rows($run_growth_15);



          if ($check_level_growth_15 == 0) {

             $total_cur_15 = $total_x15a_1+$total_x15;

             $growth_leg_15=0;

          }

          else {

            $total_cur_15 = 0;

            $growth_leg_15=1;

          }





        }else {



          $total_x15 =0;

             $total_x15a=0;

             $total_cur_15 = 0;

             $growth_leg_15=0;



        }



        $select_query_main_16 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='16' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_16 = mysqli_query($con,$select_query_main_16);

          $check_level_16 = mysqli_num_rows($run_main_16);

          while ($row_main_16 = mysqli_fetch_array($run_main_16)) {

          $tree_id_main_16 = $row_main_16['tree_id'];

          $group_number_main_16 = $row_main_16['group_number'];

          $member_no_main_16 = $row_main_16['member_no'];

          $sponsor_no_main_16 = $row_main_16['sponsor_no'];

          $level_no_main_16 = $row_main_16['level_no'];

          $relation_ship_no_main_16 = $row_main_16['relation_ship_no'];

          $x_position_main_16 = $row_main_16['x_position'];

        }



        if ($check_level_16 > 0) {



        $select_query_total_x16 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_16}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x16 = mysqli_query($con,$select_query_total_x16);

          while($row_total_x16 = mysqli_fetch_array($run_total_x16)){

                $total_x16 = $row_total_x16['SUM(product_amount)'];

          }



          $select_query_total_x16a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_16}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x16a = mysqli_query($con,$select_query_total_x16a);

          while($row_total_x16a = mysqli_fetch_array($run_total_x16a)){

                $total_x16a_1 = $row_total_x16a['SUM(roi_amount)'];





                

          }

          $total_x16a = $total_x16a_1+$total_x16;



          $select_query_growth_16 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_16}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_16 = mysqli_query($con,$select_query_growth_16);

          $check_level_growth_16 = mysqli_num_rows($run_growth_16);



          if ($check_level_growth_16 == 0) {

             $total_cur_16 = $total_x16a_1+$total_x16;

             $growth_leg_16=0;

          }

          else {

            $total_cur_16 = 0;

            $growth_leg_16=1;

          }





        }else {



          $total_x16 =0;

             $total_x16a=0;

             $total_cur_16 = 0;

             $growth_leg_16=0;



        }



        $select_query_main_17 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='17' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_17 = mysqli_query($con,$select_query_main_17);

          $check_level_17 = mysqli_num_rows($run_main_17);

          while ($row_main_17 = mysqli_fetch_array($run_main_17)) {

          $tree_id_main_17 = $row_main_17['tree_id'];

          $group_number_main_17 = $row_main_17['group_number'];

          $member_no_main_17 = $row_main_17['member_no'];

          $sponsor_no_main_17 = $row_main_17['sponsor_no'];

          $level_no_main_17 = $row_main_17['level_no'];

          $relation_ship_no_main_17 = $row_main_17['relation_ship_no'];

          $x_position_main_17 = $row_main_17['x_position'];

        }



        if ($check_level_17 > 0) {



        $select_query_total_x17 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_17}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x17 = mysqli_query($con,$select_query_total_x17);

          while($row_total_x17 = mysqli_fetch_array($run_total_x17)){

                $total_x17 = $row_total_x17['SUM(product_amount)'];

          }



          $select_query_total_x17a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_17}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x17a = mysqli_query($con,$select_query_total_x17a);

          while($row_total_x17a = mysqli_fetch_array($run_total_x17a)){

                $total_x17a_1 = $row_total_x17a['SUM(roi_amount)'];





                

          }

          $total_x17a = $total_x17a_1+$total_x17;



          $select_query_growth_17 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_17}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_17 = mysqli_query($con,$select_query_growth_17);

          $check_level_growth_17 = mysqli_num_rows($run_growth_17);



          if ($check_level_growth_17 == 0) {

             $total_cur_17 = $total_x17a_1+$total_x17;

             $growth_leg_17=0;

          }

          else {

            $total_cur_17 = 0;

            $growth_leg_17=1;

          }

        }else {



          $total_x17 =0;

             $total_x17a=0;

             $total_cur_17 = 0;

             $growth_leg_17=0;



        }



        $select_query_main_18 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='18' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_18 = mysqli_query($con,$select_query_main_18);

          $check_level_18 = mysqli_num_rows($run_main_18);

          while ($row_main_18 = mysqli_fetch_array($run_main_18)) {

          $tree_id_main_18 = $row_main_18['tree_id'];

          $group_number_main_18 = $row_main_18['group_number'];

          $member_no_main_18 = $row_main_18['member_no'];

          $sponsor_no_main_18 = $row_main_18['sponsor_no'];

          $level_no_main_18 = $row_main_18['level_no'];

          $relation_ship_no_main_18 = $row_main_18['relation_ship_no'];

          $x_position_main_18 = $row_main_18['x_position'];

        }



        if ($check_level_18 > 0) {



        $select_query_total_x18 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_18}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x18 = mysqli_query($con,$select_query_total_x18);

          while($row_total_x18 = mysqli_fetch_array($run_total_x18)){

                $total_x18 = $row_total_x18['SUM(product_amount)'];

          }



          $select_query_total_x18a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_18}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x18a = mysqli_query($con,$select_query_total_x18a);

          while($row_total_x18a = mysqli_fetch_array($run_total_x18a)){

                $total_x18a_1 = $row_total_x18a['SUM(roi_amount)'];





                

          }

          $total_x18a = $total_x18a_1+$total_x18;



          $select_query_growth_18 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_18}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_18 = mysqli_query($con,$select_query_growth_18);

          $check_level_growth_18 = mysqli_num_rows($run_growth_18);



          if ($check_level_growth_18 == 0) {

             $total_cur_18 = $total_x18a_1+$total_x18;

             $growth_leg_18=0;

          }

          else {

            $total_cur_18 = 0;

            $growth_leg_18=1;

          }





        }else {



          $total_x18 =0;

             $total_x18a=0;

             $total_cur_18 = 0;

             $growth_leg_18=0;



        }



        $select_query_main_19 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='19' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_19 = mysqli_query($con,$select_query_main_19);

          $check_level_19 = mysqli_num_rows($run_main_19);

          while ($row_main_19 = mysqli_fetch_array($run_main_19)) {

          $tree_id_main_19 = $row_main_19['tree_id'];

          $group_number_main_19 = $row_main_19['group_number'];

          $member_no_main_19 = $row_main_19['member_no'];

          $sponsor_no_main_19 = $row_main_19['sponsor_no'];

          $level_no_main_19 = $row_main_19['level_no'];

          $relation_ship_no_main_19 = $row_main_19['relation_ship_no'];

          $x_position_main_19 = $row_main_19['x_position'];

        }



        if ($check_level_19 > 0) {



        $select_query_total_x19 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_19}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x19 = mysqli_query($con,$select_query_total_x19);

          while($row_total_x19 = mysqli_fetch_array($run_total_x19)){

                $total_x19 = $row_total_x19['SUM(product_amount)'];

          }



          $select_query_total_x19a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_19}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x19a = mysqli_query($con,$select_query_total_x19a);

          while($row_total_x19a = mysqli_fetch_array($run_total_x19a)){

                $total_x19a_1 = $row_total_x19a['SUM(roi_amount)'];





                

          }

          $total_x19a = $total_x19a_1+$total_x19;



          $select_query_growth_19 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_19}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_19 = mysqli_query($con,$select_query_growth_19);

          $check_level_growth_19 = mysqli_num_rows($run_growth_19);



          if ($check_level_growth_19 == 0) {

             $total_cur_19 = $total_x19a_1+$total_x19;

             $growth_leg_19=0;

          }

          else {

            $total_cur_19 = 0;

            $growth_leg_19=1;

          }





        }else {



          $total_x19 =0;

             $total_x19a=0;

             $growth_leg_19=0;

             $total_cur_19 = 0;



        }



        $select_query_main_20 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='20' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_20 = mysqli_query($con,$select_query_main_20);

          $check_level_20 = mysqli_num_rows($run_main_20);

          while ($row_main_20 = mysqli_fetch_array($run_main_20)) {

          $tree_id_main_20 = $row_main_20['tree_id'];

          $group_number_main_20 = $row_main_20['group_number'];

          $member_no_main_20 = $row_main_20['member_no'];

          $sponsor_no_main_20 = $row_main_20['sponsor_no'];

          $level_no_main_20 = $row_main_20['level_no'];

          $relation_ship_no_main_20 = $row_main_20['relation_ship_no'];

          $x_position_main_20 = $row_main_20['x_position'];

        }



        if ($check_level_20 > 0) {



        $select_query_total_x20 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_20}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x20 = mysqli_query($con,$select_query_total_x20);

          while($row_total_x20 = mysqli_fetch_array($run_total_x20)){

                $total_x20 = $row_total_x20['SUM(product_amount)'];

          }



          $select_query_total_x20a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_20}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x20a = mysqli_query($con,$select_query_total_x20a);

          while($row_total_x20a = mysqli_fetch_array($run_total_x20a)){

                $total_x20a_1 = $row_total_x20a['SUM(roi_amount)'];





                

          }

          $total_x20a = $total_x20a_1+$total_x20;



          $select_query_growth_20 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_20}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_20 = mysqli_query($con,$select_query_growth_20);

          $check_level_growth_20 = mysqli_num_rows($run_growth_20);



          if ($check_level_growth_20 == 0) {

             $total_cur_20 = $total_x20a_1+$total_x20;

             $growth_leg_20=0;

          }

          else {

            $total_cur_20 = 0;

            $growth_leg_20=1;

          }





        }else {



          $total_x20 =0;

             $total_x20a=0;

             $total_cur_20 = 0;

             $growth_leg_20=0;



        }



        $select_query_main_21 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='21' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_21 = mysqli_query($con,$select_query_main_21);

          $check_level_21 = mysqli_num_rows($run_main_21);

          while ($row_main_21 = mysqli_fetch_array($run_main_21)) {

          $tree_id_main_21 = $row_main_21['tree_id'];

          $group_number_main_21 = $row_main_21['group_number'];

          $member_no_main_21 = $row_main_21['member_no'];

          $sponsor_no_main_21 = $row_main_21['sponsor_no'];

          $level_no_main_21 = $row_main_21['level_no'];

          $relation_ship_no_main_21 = $row_main_21['relation_ship_no'];

          $x_position_main_21 = $row_main_21['x_position'];

        }



        if ($check_level_21 > 0) {



        $select_query_total_x21 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_21}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x21 = mysqli_query($con,$select_query_total_x21);

          while($row_total_x21 = mysqli_fetch_array($run_total_x21)){

                $total_x21 = $row_total_x21['SUM(product_amount)'];

          }



          $select_query_total_x21a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_21}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x21a = mysqli_query($con,$select_query_total_x21a);

          while($row_total_x21a = mysqli_fetch_array($run_total_x21a)){

                $total_x21a_1 = $row_total_x21a['SUM(roi_amount)'];





                

          }

          $total_x21a = $total_x21a_1+$total_x21;



          $select_query_growth_21 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_21}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_21 = mysqli_query($con,$select_query_growth_21);

          $check_level_growth_21 = mysqli_num_rows($run_growth_21);



          if ($check_level_growth_21 == 0) {

             $total_cur_21 = $total_x21a_1+$total_x21;

             $growth_leg_21=0;

          }

          else {

            $total_cur_21 = 0;

            $growth_leg_21=1;

          }





        }else {



          $total_x21 =0;

             $total_x21a=0;

             $total_cur_21 = 0;

             $growth_leg_21=0;



        }







        $select_query_main_22 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='22' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_22 = mysqli_query($con,$select_query_main_22);

          $check_level_22 = mysqli_num_rows($run_main_22);

          while ($row_main_22 = mysqli_fetch_array($run_main_22)) {

          $tree_id_main_22 = $row_main_22['tree_id'];

          $group_number_main_22 = $row_main_22['group_number'];

          $member_no_main_22 = $row_main_22['member_no'];

          $sponsor_no_main_22 = $row_main_22['sponsor_no'];

          $level_no_main_22 = $row_main_22['level_no'];

          $relation_ship_no_main_22 = $row_main_22['relation_ship_no'];

          $x_position_main_22 = $row_main_22['x_position'];

        }



        if ($check_level_22 > 0) {



        $select_query_total_x22 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_22}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x22 = mysqli_query($con,$select_query_total_x22);

          while($row_total_x22 = mysqli_fetch_array($run_total_x22)){

                $total_x22 = $row_total_x22['SUM(product_amount)'];

          }



          $select_query_total_x22a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_22}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x22a = mysqli_query($con,$select_query_total_x22a);

          while($row_total_x22a = mysqli_fetch_array($run_total_x22a)){

                $total_x22a_1 = $row_total_x22a['SUM(roi_amount)'];





                

          }

          $total_x22a = $total_x22a_1+$total_x22;



          $select_query_growth_22 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_22}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_22 = mysqli_query($con,$select_query_growth_22);

          $check_level_growth_22 = mysqli_num_rows($run_growth_22);



          if ($check_level_growth_22 == 0) {

             $total_cur_22 = $total_x22a_1+$total_x22;

             $growth_leg_22=0;

          }

          else {

            $total_cur_22 = 0;

            $growth_leg_22=1;

          }





        }else {



          $total_x22 =0;

             $total_x22a=0;

             $total_cur_22 = 0;

             $growth_leg_22=0;



        }







        $select_query_main_23 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='23' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_23 = mysqli_query($con,$select_query_main_23);

          $check_level_23 = mysqli_num_rows($run_main_23);

          while ($row_main_23 = mysqli_fetch_array($run_main_23)) {

          $tree_id_main_23 = $row_main_23['tree_id'];

          $group_number_main_23 = $row_main_23['group_number'];

          $member_no_main_23 = $row_main_23['member_no'];

          $sponsor_no_main_23 = $row_main_23['sponsor_no'];

          $level_no_main_23 = $row_main_23['level_no'];

          $relation_ship_no_main_23 = $row_main_23['relation_ship_no'];

          $x_position_main_23 = $row_main_23['x_position'];

        }



        if ($check_level_23 > 0) {



        $select_query_total_x23 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_23}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x23 = mysqli_query($con,$select_query_total_x23);

          while($row_total_x23 = mysqli_fetch_array($run_total_x23)){

                $total_x23 = $row_total_x23['SUM(product_amount)'];

          }



          $select_query_total_x23a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_23}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x23a = mysqli_query($con,$select_query_total_x23a);

          while($row_total_x23a = mysqli_fetch_array($run_total_x23a)){

                $total_x23a_1 = $row_total_x23a['SUM(roi_amount)'];





                

          }

          $total_x23a = $total_x23a_1+$total_x23;



          $select_query_growth_23 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_23}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_23 = mysqli_query($con,$select_query_growth_23);

          $check_level_growth_23 = mysqli_num_rows($run_growth_23);



          if ($check_level_growth_23 == 0) {

             $total_cur_23 = $total_x23a_1+$total_x23;

             $growth_leg_23=0;

          }

          else {

            $total_cur_23 = 0;

            $growth_leg_23=1;

          }





        }else {



          $total_x23 =0;

             $total_x23a=0;

             $total_cur_23 = 0;

             $growth_leg_23=0;



        }







        $select_query_main_24 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='24' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_24 = mysqli_query($con,$select_query_main_24);

          $check_level_24 = mysqli_num_rows($run_main_24);

          while ($row_main_24 = mysqli_fetch_array($run_main_24)) {

          $tree_id_main_24 = $row_main_24['tree_id'];

          $group_number_main_24 = $row_main_24['group_number'];

          $member_no_main_24 = $row_main_24['member_no'];

          $sponsor_no_main_24 = $row_main_24['sponsor_no'];

          $level_no_main_24 = $row_main_24['level_no'];

          $relation_ship_no_main_24 = $row_main_24['relation_ship_no'];

          $x_position_main_24 = $row_main_24['x_position'];

        }



        if ($check_level_24 > 0) {



        $select_query_total_x24 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_24}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x24 = mysqli_query($con,$select_query_total_x24);

          while($row_total_x24 = mysqli_fetch_array($run_total_x24)){

                $total_x24 = $row_total_x24['SUM(product_amount)'];

          }



          $select_query_total_x24a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_24}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x24a = mysqli_query($con,$select_query_total_x24a);

          while($row_total_x24a = mysqli_fetch_array($run_total_x24a)){

                $total_x24a_1 = $row_total_x24a['SUM(roi_amount)'];





                

          }

          $total_x24a = $total_x24a_1+$total_x24;



          $select_query_growth_24 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_24}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_24 = mysqli_query($con,$select_query_growth_24);

          $check_level_growth_24 = mysqli_num_rows($run_growth_24);



          if ($check_level_growth_24 == 0) {

             $total_cur_24 = $total_x24a_1+$total_x24;

             $growth_leg_24=0;

          }

          else {

            $total_cur_24 = 0;

            $growth_leg_24=1;

          }





        }else {



          $total_x24 =0;

             $total_x24a=0;

             $total_cur_24 = 0;

             $growth_leg_24=0;



        }







        $select_query_main_25 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='25' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_25 = mysqli_query($con,$select_query_main_25);

          $check_level_25 = mysqli_num_rows($run_main_25);

          while ($row_main_25 = mysqli_fetch_array($run_main_25)) {

          $tree_id_main_25 = $row_main_25['tree_id'];

          $group_number_main_25 = $row_main_25['group_number'];

          $member_no_main_25 = $row_main_25['member_no'];

          $sponsor_no_main_25 = $row_main_25['sponsor_no'];

          $level_no_main_25 = $row_main_25['level_no'];

          $relation_ship_no_main_25 = $row_main_25['relation_ship_no'];

          $x_position_main_25 = $row_main_25['x_position'];

        }



        if ($check_level_25 > 0) {



        $select_query_total_x25 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_25}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x25 = mysqli_query($con,$select_query_total_x25);

          while($row_total_x25 = mysqli_fetch_array($run_total_x25)){

                $total_x25 = $row_total_x25['SUM(product_amount)'];

          }



          $select_query_total_x25a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_25}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x25a = mysqli_query($con,$select_query_total_x25a);

          while($row_total_x25a = mysqli_fetch_array($run_total_x25a)){

                $total_x25a_1 = $row_total_x25a['SUM(roi_amount)'];





                

          }

          $total_x25a = $total_x25a_1+$total_x25;



          $select_query_growth_25 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_25}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_25 = mysqli_query($con,$select_query_growth_25);

          $check_level_growth_25 = mysqli_num_rows($run_growth_25);



          if ($check_level_growth_25 == 0) {

             $total_cur_25 = $total_x25a_1+$total_x25;

             $growth_leg_25=0;

          }

          else {

            $total_cur_25 = 0;

            $growth_leg_25=1;

          }





        }else {



          $total_x25 =0;

             $total_x25a=0;

             $total_cur_25 = 0;

             $growth_leg_25=0;



        }







        $select_query_main_26 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='26' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_26 = mysqli_query($con,$select_query_main_26);

          $check_level_26 = mysqli_num_rows($run_main_26);

          while ($row_main_26 = mysqli_fetch_array($run_main_26)) {

          $tree_id_main_26 = $row_main_26['tree_id'];

          $group_number_main_26 = $row_main_26['group_number'];

          $member_no_main_26 = $row_main_26['member_no'];

          $sponsor_no_main_26 = $row_main_26['sponsor_no'];

          $level_no_main_26 = $row_main_26['level_no'];

          $relation_ship_no_main_26 = $row_main_26['relation_ship_no'];

          $x_position_main_26 = $row_main_26['x_position'];

        }



        if ($check_level_26 > 0) {



        $select_query_total_x26 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_26}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x26 = mysqli_query($con,$select_query_total_x26);

          while($row_total_x26 = mysqli_fetch_array($run_total_x26)){

                $total_x26 = $row_total_x26['SUM(product_amount)'];

          }



          $select_query_total_x26a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_26}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x26a = mysqli_query($con,$select_query_total_x26a);

          while($row_total_x26a = mysqli_fetch_array($run_total_x26a)){

                $total_x26a_1 = $row_total_x26a['SUM(roi_amount)'];





                

          }

          $total_x26a = $total_x26a_1+$total_x26;



          $select_query_growth_26 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_26}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_26 = mysqli_query($con,$select_query_growth_26);

          $check_level_growth_26 = mysqli_num_rows($run_growth_26);



          if ($check_level_growth_26 == 0) {

             $total_cur_26 = $total_x26a_1+$total_x26;

             $growth_leg_26=0;

          }

          else {

            $total_cur_26 = 0;

            $growth_leg_26=1;

          }





        }else {



          $total_x26 =0;

             $total_x26a=0;

             $total_cur_26 = 0;

             $growth_leg_26=0;



        }







        $select_query_main_27 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='27' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_27 = mysqli_query($con,$select_query_main_27);

          $check_level_27 = mysqli_num_rows($run_main_27);

          while ($row_main_27 = mysqli_fetch_array($run_main_27)) {

          $tree_id_main_27 = $row_main_27['tree_id'];

          $group_number_main_27 = $row_main_27['group_number'];

          $member_no_main_27 = $row_main_27['member_no'];

          $sponsor_no_main_27 = $row_main_27['sponsor_no'];

          $level_no_main_27 = $row_main_27['level_no'];

          $relation_ship_no_main_27 = $row_main_27['relation_ship_no'];

          $x_position_main_27 = $row_main_27['x_position'];

        }



        if ($check_level_27 > 0) {



        $select_query_total_x27 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_27}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x27 = mysqli_query($con,$select_query_total_x27);

          while($row_total_x27 = mysqli_fetch_array($run_total_x27)){

                $total_x27 = $row_total_x27['SUM(product_amount)'];

          }



          $select_query_total_x27a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_27}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x27a = mysqli_query($con,$select_query_total_x27a);

          while($row_total_x27a = mysqli_fetch_array($run_total_x27a)){

                $total_x27a_1 = $row_total_x27a['SUM(roi_amount)'];





                

          }

          $total_x27a = $total_x27a_1+$total_x27;



          $select_query_growth_27 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_27}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_27 = mysqli_query($con,$select_query_growth_27);

          $check_level_growth_27 = mysqli_num_rows($run_growth_27);



          if ($check_level_growth_27 == 0) {

             $total_cur_27 = $total_x27a_1+$total_x27;

             $growth_leg_27=0;

          }

          else {

            $total_cur_27 = 0;

            $growth_leg_27=1;

          }





        }else {



          $total_x27 =0;

             $total_x27a=0;

             $total_cur_27 = 0;

             $growth_leg_27=0;



        }







        $select_query_main_28 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='28' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_28 = mysqli_query($con,$select_query_main_28);

          $check_level_28 = mysqli_num_rows($run_main_28);

          while ($row_main_28 = mysqli_fetch_array($run_main_28)) {

          $tree_id_main_28 = $row_main_28['tree_id'];

          $group_number_main_28 = $row_main_28['group_number'];

          $member_no_main_28 = $row_main_28['member_no'];

          $sponsor_no_main_28 = $row_main_28['sponsor_no'];

          $level_no_main_28 = $row_main_28['level_no'];

          $relation_ship_no_main_28 = $row_main_28['relation_ship_no'];

          $x_position_main_28 = $row_main_28['x_position'];

        }



        if ($check_level_28 > 0) {



        $select_query_total_x28 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_28}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x28 = mysqli_query($con,$select_query_total_x28);

          while($row_total_x28 = mysqli_fetch_array($run_total_x28)){

                $total_x28 = $row_total_x28['SUM(product_amount)'];

          }



          $select_query_total_x28a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_28}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x28a = mysqli_query($con,$select_query_total_x28a);

          while($row_total_x28a = mysqli_fetch_array($run_total_x28a)){

                $total_x28a_1 = $row_total_x28a['SUM(roi_amount)'];





                

          }

          $total_x28a = $total_x28a_1+$total_x28;



          $select_query_growth_28 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_28}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_28 = mysqli_query($con,$select_query_growth_28);

          $check_level_growth_28 = mysqli_num_rows($run_growth_28);



          if ($check_level_growth_28 == 0) {

             $total_cur_28 = $total_x28a_1+$total_x28;

             $growth_leg_28=0;

          }

          else {

            $total_cur_28 = 0;

            $growth_leg_28=1;

          }



        }else {



          $total_x28 =0;

             $total_x28a=0;

             $total_cur_28 = 0;

             $growth_leg_28=0;



        }





        $select_query_main_29 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='29' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_29 = mysqli_query($con,$select_query_main_29);

          $check_level_29 = mysqli_num_rows($run_main_29);

          while ($row_main_29 = mysqli_fetch_array($run_main_29)) {

          $tree_id_main_29 = $row_main_29['tree_id'];

          $group_number_main_29 = $row_main_29['group_number'];

          $member_no_main_29 = $row_main_29['member_no'];

          $sponsor_no_main_29 = $row_main_29['sponsor_no'];

          $level_no_main_29 = $row_main_29['level_no'];

          $relation_ship_no_main_29 = $row_main_29['relation_ship_no'];

          $x_position_main_29 = $row_main_29['x_position'];

        }



        if ($check_level_29 > 0) {



        $select_query_total_x29 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_29}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x29 = mysqli_query($con,$select_query_total_x29);

          while($row_total_x29 = mysqli_fetch_array($run_total_x29)){

                $total_x29 = $row_total_x29['SUM(product_amount)'];

          }



          $select_query_total_x29a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_29}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x29a = mysqli_query($con,$select_query_total_x29a);

          while($row_total_x29a = mysqli_fetch_array($run_total_x29a)){

                $total_x29a_1 = $row_total_x29a['SUM(roi_amount)'];





                

          }

          $total_x29a = $total_x29a_1+$total_x29;



          $select_query_growth_29 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_29}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_29 = mysqli_query($con,$select_query_growth_29);

          $check_level_growth_29 = mysqli_num_rows($run_growth_29);



          if ($check_level_growth_29 == 0) {

             $total_cur_29 = $total_x29a_1+$total_x29;

             $growth_leg_29=0;

          }

          else {

            $total_cur_29 = 0;

            $growth_leg_29=1;

          }





        }else {



          $total_x29 =0;

             $total_x29a=0;

             $total_cur_29 = 0;

             $growth_leg_29=0;



        }







        $select_query_main_30 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='30' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_30 = mysqli_query($con,$select_query_main_30);

          $check_level_30 = mysqli_num_rows($run_main_30);

          while ($row_main_30 = mysqli_fetch_array($run_main_30)) {

          $tree_id_main_30 = $row_main_30['tree_id'];

          $group_number_main_30 = $row_main_30['group_number'];

          $member_no_main_30 = $row_main_30['member_no'];

          $sponsor_no_main_30 = $row_main_30['sponsor_no'];

          $level_no_main_30 = $row_main_30['level_no'];

          $relation_ship_no_main_30 = $row_main_30['relation_ship_no'];

          $x_position_main_30 = $row_main_30['x_position'];

        }



        if ($check_level_30 > 0) {



        $select_query_total_x30 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_30}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x30 = mysqli_query($con,$select_query_total_x30);

          while($row_total_x30 = mysqli_fetch_array($run_total_x30)){

                $total_x30 = $row_total_x30['SUM(product_amount)'];

          }



          $select_query_total_x30a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_30}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x30a = mysqli_query($con,$select_query_total_x30a);

          while($row_total_x30a = mysqli_fetch_array($run_total_x30a)){

                $total_x30a_1 = $row_total_x30a['SUM(roi_amount)'];





                

          }

          $total_x30a = $total_x30a_1+$total_x30;



          $select_query_growth_30 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_30}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_30 = mysqli_query($con,$select_query_growth_30);

          $check_level_growth_30 = mysqli_num_rows($run_growth_30);



          if ($check_level_growth_30 == 0) {

             $total_cur_30 = $total_x30a_1+$total_x30;

             $growth_leg_30=0;

          }

          else {

            $total_cur_30 = 0;

            $growth_leg_30=1;

          }





        }else {



          $total_x30 =0;

             $total_x30a=0;

             $total_cur_30 = 0;

             $growth_leg_30=0;



        }



        $select_query_main_31 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='31' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_31 = mysqli_query($con,$select_query_main_31);

          $check_level_31 = mysqli_num_rows($run_main_31);

          while ($row_main_31 = mysqli_fetch_array($run_main_31)) {

          $tree_id_main_31 = $row_main_31['tree_id'];

          $group_number_main_31 = $row_main_31['group_number'];

          $member_no_main_31 = $row_main_31['member_no'];

          $sponsor_no_main_31 = $row_main_31['sponsor_no'];

          $level_no_main_31 = $row_main_31['level_no'];

          $relation_ship_no_main_31 = $row_main_31['relation_ship_no'];

          $x_position_main_31 = $row_main_31['x_position'];

        }



        if ($check_level_31 > 0) {



        $select_query_total_x31 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_31}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x31 = mysqli_query($con,$select_query_total_x31);

          while($row_total_x31 = mysqli_fetch_array($run_total_x31)){

                $total_x31 = $row_total_x31['SUM(product_amount)'];

          }



          $select_query_total_x31a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_31}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x31a = mysqli_query($con,$select_query_total_x31a);

          while($row_total_x31a = mysqli_fetch_array($run_total_x31a)){

                $total_x31a_1 = $row_total_x31a['SUM(roi_amount)'];





                

          }

          $total_x31a = $total_x31a_1+$total_x31;



          $select_query_growth_31 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_31}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_31 = mysqli_query($con,$select_query_growth_31);

          $check_level_growth_31 = mysqli_num_rows($run_growth_31);



          if ($check_level_growth_31 == 0) {

             $total_cur_31 = $total_x31a_1+$total_x31;

             $growth_leg_31=0;

          }

          else {

            $total_cur_31 = 0;

            $growth_leg_31=1;

          }





        }else {



          $total_x31 =0;

             $total_x31a=0;

             $total_cur_31 = 0;

             $growth_leg_31=0;



        }



        $select_query_main_32 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='32' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_32 = mysqli_query($con,$select_query_main_32);

          $check_level_32 = mysqli_num_rows($run_main_32);

          while ($row_main_32 = mysqli_fetch_array($run_main_32)) {

          $tree_id_main_32 = $row_main_32['tree_id'];

          $group_number_main_32 = $row_main_32['group_number'];

          $member_no_main_32 = $row_main_32['member_no'];

          $sponsor_no_main_32 = $row_main_32['sponsor_no'];

          $level_no_main_32 = $row_main_32['level_no'];

          $relation_ship_no_main_32 = $row_main_32['relation_ship_no'];

          $x_position_main_32 = $row_main_32['x_position'];

        }



        if ($check_level_32 > 0) {



        $select_query_total_x32 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_32}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x32 = mysqli_query($con,$select_query_total_x32);

          while($row_total_x32 = mysqli_fetch_array($run_total_x32)){

                $total_x32 = $row_total_x32['SUM(product_amount)'];

          }



          $select_query_total_x32a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_32}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x32a = mysqli_query($con,$select_query_total_x32a);

          while($row_total_x32a = mysqli_fetch_array($run_total_x32a)){

                $total_x32a_1 = $row_total_x32a['SUM(roi_amount)'];





                

          }

          $total_x32a = $total_x32a_1+$total_x32;



          $select_query_growth_32 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_32}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_32 = mysqli_query($con,$select_query_growth_32);

          $check_level_growth_32 = mysqli_num_rows($run_growth_32);



          if ($check_level_growth_32 == 0) {

             $total_cur_32 = $total_x32a_1+$total_x32;

             $growth_leg_32=0;

          }

          else {

            $total_cur_32 = 0;

            $growth_leg_32=1;

          }





        }else {



          $total_x32 =0;

             $total_x32a=0;

             $total_cur_32 = 0;

             $growth_leg_32=0;



        }



        $select_query_main_33 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='33' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_33 = mysqli_query($con,$select_query_main_33);

          $check_level_33 = mysqli_num_rows($run_main_33);

          while ($row_main_33 = mysqli_fetch_array($run_main_33)) {

          $tree_id_main_33 = $row_main_33['tree_id'];

          $group_number_main_33 = $row_main_33['group_number'];

          $member_no_main_33 = $row_main_33['member_no'];

          $sponsor_no_main_33 = $row_main_33['sponsor_no'];

          $level_no_main_33 = $row_main_33['level_no'];

          $relation_ship_no_main_33 = $row_main_33['relation_ship_no'];

          $x_position_main_33 = $row_main_33['x_position'];

        }



        if ($check_level_33 > 0) {



        $select_query_total_x33 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_33}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x33 = mysqli_query($con,$select_query_total_x33);

          while($row_total_x33 = mysqli_fetch_array($run_total_x33)){

                $total_x33 = $row_total_x33['SUM(product_amount)'];

          }



          $select_query_total_x33a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_33}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x33a = mysqli_query($con,$select_query_total_x33a);

          while($row_total_x33a = mysqli_fetch_array($run_total_x33a)){

                $total_x33a_1 = $row_total_x33a['SUM(roi_amount)'];





                

          }

          $total_x33a = $total_x33a_1+$total_x33;



          $select_query_growth_33 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_33}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_33 = mysqli_query($con,$select_query_growth_33);

          $check_level_growth_33 = mysqli_num_rows($run_growth_33);



          if ($check_level_growth_33 == 0) {

             $total_cur_33 = $total_x33a_1+$total_x33;

             $growth_leg_33=0;

          }

          else {

            $total_cur_33 = 0;

            $growth_leg_33=1;

          }





        }else {



          $total_x33 =0;

             $total_x33a=0;

             $total_cur_33 = 0;

             $growth_leg_33=0;



        }



        $select_query_main_34 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='34' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_34 = mysqli_query($con,$select_query_main_34);

          $check_level_34 = mysqli_num_rows($run_main_34);

          while ($row_main_34 = mysqli_fetch_array($run_main_34)) {

          $tree_id_main_34 = $row_main_34['tree_id'];

          $group_number_main_34 = $row_main_34['group_number'];

          $member_no_main_34 = $row_main_34['member_no'];

          $sponsor_no_main_34 = $row_main_34['sponsor_no'];

          $level_no_main_34 = $row_main_34['level_no'];

          $relation_ship_no_main_34 = $row_main_34['relation_ship_no'];

          $x_position_main_34 = $row_main_34['x_position'];

        }



        if ($check_level_34 > 0) {



        $select_query_total_x34 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_34}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x34 = mysqli_query($con,$select_query_total_x34);

          while($row_total_x34 = mysqli_fetch_array($run_total_x34)){

                $total_x34 = $row_total_x34['SUM(product_amount)'];

          }



          $select_query_total_x34a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_34}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x34a = mysqli_query($con,$select_query_total_x34a);

          while($row_total_x34a = mysqli_fetch_array($run_total_x34a)){

                $total_x34a_1 = $row_total_x34a['SUM(roi_amount)'];





                

          }

          $total_x34a = $total_x34a_1+$total_x34;



          $select_query_growth_34 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_34}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_34 = mysqli_query($con,$select_query_growth_34);

          $check_level_growth_34 = mysqli_num_rows($run_growth_34);



          if ($check_level_growth_34 == 0) {

             $total_cur_34 = $total_x34a_1+$total_x34;

             $growth_leg_34=0;

          }

          else {

            $total_cur_34 = 0;

            $growth_leg_34=1;

          }





        }else {



          $total_x34 =0;

             $total_x34a=0;

             $total_cur_34 = 0;

             $growth_leg_34=0;



        }



        $select_query_main_35 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='35' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_35 = mysqli_query($con,$select_query_main_35);

          $check_level_35 = mysqli_num_rows($run_main_35);

          while ($row_main_35 = mysqli_fetch_array($run_main_35)) {

          $tree_id_main_35 = $row_main_35['tree_id'];

          $group_number_main_35 = $row_main_35['group_number'];

          $member_no_main_35 = $row_main_35['member_no'];

          $sponsor_no_main_35 = $row_main_35['sponsor_no'];

          $level_no_main_35 = $row_main_35['level_no'];

          $relation_ship_no_main_35 = $row_main_35['relation_ship_no'];

          $x_position_main_35 = $row_main_35['x_position'];

        }



        if ($check_level_35 > 0) {



        $select_query_total_x35 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_35}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x35 = mysqli_query($con,$select_query_total_x35);

          while($row_total_x35 = mysqli_fetch_array($run_total_x35)){

                $total_x35 = $row_total_x35['SUM(product_amount)'];

          }



          $select_query_total_x35a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_35}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x35a = mysqli_query($con,$select_query_total_x35a);

          while($row_total_x35a = mysqli_fetch_array($run_total_x35a)){

                $total_x35a_1 = $row_total_x35a['SUM(roi_amount)'];





                

          }

          $total_x35a = $total_x35a_1+$total_x35;



          $select_query_growth_35 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_35}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_35 = mysqli_query($con,$select_query_growth_35);

          $check_level_growth_35 = mysqli_num_rows($run_growth_35);



          if ($check_level_growth_35 == 0) {

             $total_cur_35 = $total_x35a_1+$total_x35;

             $growth_leg_35=0;

          }

          else {

            $total_cur_35 = 0;

            $growth_leg_35=1;

          }





        }else {



          $total_x35 =0;

             $total_x35a=0;

             $total_cur_35 = 0;

             $growth_leg_35=0;



        }



        $select_query_main_36 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='36' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_36 = mysqli_query($con,$select_query_main_36);

          $check_level_36 = mysqli_num_rows($run_main_36);

          while ($row_main_36 = mysqli_fetch_array($run_main_36)) {

          $tree_id_main_36 = $row_main_36['tree_id'];

          $group_number_main_36 = $row_main_36['group_number'];

          $member_no_main_36 = $row_main_36['member_no'];

          $sponsor_no_main_36 = $row_main_36['sponsor_no'];

          $level_no_main_36 = $row_main_36['level_no'];

          $relation_ship_no_main_36 = $row_main_36['relation_ship_no'];

          $x_position_main_36 = $row_main_36['x_position'];

        }



        if ($check_level_36 > 0) {



        $select_query_total_x36 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_36}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x36 = mysqli_query($con,$select_query_total_x36);

          while($row_total_x36 = mysqli_fetch_array($run_total_x36)){

                $total_x36 = $row_total_x36['SUM(product_amount)'];

          }



          $select_query_total_x36a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_36}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x36a = mysqli_query($con,$select_query_total_x36a);

          while($row_total_x36a = mysqli_fetch_array($run_total_x36a)){

                $total_x36a_1 = $row_total_x36a['SUM(roi_amount)'];





                

          }

          $total_x36a = $total_x36a_1+$total_x36;



          $select_query_growth_36 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_36}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_36 = mysqli_query($con,$select_query_growth_36);

          $check_level_growth_36 = mysqli_num_rows($run_growth_36);



          if ($check_level_growth_36 == 0) {

             $total_cur_36 = $total_x36a_1+$total_x36;

             $growth_leg_36=0;

          }

          else {

            $total_cur_36 = 0;

            $growth_leg_36=1;

          }





        }else {



          $total_x36 =0;

             $total_x36a=0;

             $total_cur_36 = 0;

             $growth_leg_36=0;



        }



        $select_query_main_37 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='37' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_37 = mysqli_query($con,$select_query_main_37);

          $check_level_37 = mysqli_num_rows($run_main_37);

          while ($row_main_37 = mysqli_fetch_array($run_main_37)) {

          $tree_id_main_37 = $row_main_37['tree_id'];

          $group_number_main_37 = $row_main_37['group_number'];

          $member_no_main_37 = $row_main_37['member_no'];

          $sponsor_no_main_37 = $row_main_37['sponsor_no'];

          $level_no_main_37 = $row_main_37['level_no'];

          $relation_ship_no_main_37 = $row_main_37['relation_ship_no'];

          $x_position_main_37 = $row_main_37['x_position'];

        }



        if ($check_level_37 > 0) {



        $select_query_total_x37 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_37}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x37 = mysqli_query($con,$select_query_total_x37);

          while($row_total_x37 = mysqli_fetch_array($run_total_x37)){

                $total_x37 = $row_total_x37['SUM(product_amount)'];

          }



          $select_query_total_x37a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_37}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x37a = mysqli_query($con,$select_query_total_x37a);

          while($row_total_x37a = mysqli_fetch_array($run_total_x37a)){

                $total_x37a_1 = $row_total_x37a['SUM(roi_amount)'];





                

          }

          $total_x37a = $total_x37a_1+$total_x37;



          $select_query_growth_37 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_37}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_37 = mysqli_query($con,$select_query_growth_37);

          $check_level_growth_37 = mysqli_num_rows($run_growth_37);



          if ($check_level_growth_37 == 0) {

             $total_cur_37 = $total_x37a_1+$total_x37;

             $growth_leg_37=0;

          }

          else {

            $total_cur_37 = 0;

            $growth_leg_37=1;

          }





        }else {



          $total_x37 =0;

             $total_x37a=0;

             $total_cur_37 = 0;

             $growth_leg_37=0;



        }



        $select_query_main_38 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='38' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_38 = mysqli_query($con,$select_query_main_38);

          $check_level_38 = mysqli_num_rows($run_main_38);

          while ($row_main_38 = mysqli_fetch_array($run_main_38)) {

          $tree_id_main_38 = $row_main_38['tree_id'];

          $group_number_main_38 = $row_main_38['group_number'];

          $member_no_main_38 = $row_main_38['member_no'];

          $sponsor_no_main_38 = $row_main_38['sponsor_no'];

          $level_no_main_38 = $row_main_38['level_no'];

          $relation_ship_no_main_38 = $row_main_38['relation_ship_no'];

          $x_position_main_38 = $row_main_38['x_position'];

        }



        if ($check_level_38 > 0) {



        $select_query_total_x38 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_38}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x38 = mysqli_query($con,$select_query_total_x38);

          while($row_total_x38 = mysqli_fetch_array($run_total_x38)){

                $total_x38 = $row_total_x38['SUM(product_amount)'];

          }



          $select_query_total_x38a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_38}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x38a = mysqli_query($con,$select_query_total_x38a);

          while($row_total_x38a = mysqli_fetch_array($run_total_x38a)){

                $total_x38a_1 = $row_total_x38a['SUM(roi_amount)'];





                

          }

          $total_x38a = $total_x38a_1+$total_x38;



          $select_query_growth_38 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_38}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_38 = mysqli_query($con,$select_query_growth_38);

          $check_level_growth_38 = mysqli_num_rows($run_growth_38);



          if ($check_level_growth_38 == 0) {

             $total_cur_38 = $total_x38a_1+$total_x38;

             $growth_leg_38=0;

          }

          else {

            $total_cur_38 = 0;

            $growth_leg_38=1;

          }





        }else {



          $total_x38 =0;

             $total_x38a=0;

             $total_cur_38 = 0;

             $growth_leg_38=0;



        }



        $select_query_main_39 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='39' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_39 = mysqli_query($con,$select_query_main_39);

          $check_level_39 = mysqli_num_rows($run_main_39);

          while ($row_main_39 = mysqli_fetch_array($run_main_39)) {

          $tree_id_main_39 = $row_main_39['tree_id'];

          $group_number_main_39 = $row_main_39['group_number'];

          $member_no_main_39 = $row_main_39['member_no'];

          $sponsor_no_main_39 = $row_main_39['sponsor_no'];

          $level_no_main_39 = $row_main_39['level_no'];

          $relation_ship_no_main_39 = $row_main_39['relation_ship_no'];

          $x_position_main_39 = $row_main_39['x_position'];

        }



        if ($check_level_39 > 0) {



        $select_query_total_x39 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_39}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x39 = mysqli_query($con,$select_query_total_x39);

          while($row_total_x39 = mysqli_fetch_array($run_total_x39)){

                $total_x39 = $row_total_x39['SUM(product_amount)'];

          }



          $select_query_total_x39a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_39}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x39a = mysqli_query($con,$select_query_total_x39a);

          while($row_total_x39a = mysqli_fetch_array($run_total_x39a)){

                $total_x39a_1 = $row_total_x39a['SUM(roi_amount)'];





                

          }

          $total_x39a = $total_x39a_1+$total_x39;



          $select_query_growth_39 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_39}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_39 = mysqli_query($con,$select_query_growth_39);

          $check_level_growth_39 = mysqli_num_rows($run_growth_39);



          if ($check_level_growth_39 == 0) {

             $total_cur_39 = $total_x39a_1+$total_x39;

             $growth_leg_39=0;

          }

          else {

            $total_cur_39 = 0;

            $growth_leg_39=1;

          }





        }else {



          $total_x39 =0;

             $total_x39a=0;

             $total_cur_39 = 0;

             $growth_leg_39=0;



        }



        $select_query_main_40 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='40' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_40 = mysqli_query($con,$select_query_main_40);

          $check_level_40 = mysqli_num_rows($run_main_40);

          while ($row_main_40 = mysqli_fetch_array($run_main_40)) {

          $tree_id_main_40 = $row_main_40['tree_id'];

          $group_number_main_40 = $row_main_40['group_number'];

          $member_no_main_40 = $row_main_40['member_no'];

          $sponsor_no_main_40 = $row_main_40['sponsor_no'];

          $level_no_main_40 = $row_main_40['level_no'];

          $relation_ship_no_main_40 = $row_main_40['relation_ship_no'];

          $x_position_main_40 = $row_main_40['x_position'];

        }



        if ($check_level_40 > 0) {



        $select_query_total_x40 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_40}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x40 = mysqli_query($con,$select_query_total_x40);

          while($row_total_x40 = mysqli_fetch_array($run_total_x40)){

                $total_x40 = $row_total_x40['SUM(product_amount)'];

          }



          $select_query_total_x40a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_40}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x40a = mysqli_query($con,$select_query_total_x40a);

          while($row_total_x40a = mysqli_fetch_array($run_total_x40a)){

                $total_x40a_1 = $row_total_x40a['SUM(roi_amount)'];





                

          }

          $total_x40a = $total_x40a_1+$total_x40;



          $select_query_growth_40 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_40}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_40 = mysqli_query($con,$select_query_growth_40);

          $check_level_growth_40 = mysqli_num_rows($run_growth_40);



          if ($check_level_growth_40 == 0) {

             $total_cur_40 = $total_x40a_1+$total_x40;

             $growth_leg_40=0;

          }

          else {

            $total_cur_40 = 0;

            $growth_leg_40=1;

          }





        }else {



          $total_x40 =0;

             $total_x40a=0;

             $total_cur_40 = 0;

             $growth_leg_40=0;



        }



        $select_query_main_41 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='41' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_41 = mysqli_query($con,$select_query_main_41);

          $check_level_41 = mysqli_num_rows($run_main_41);

          while ($row_main_41 = mysqli_fetch_array($run_main_41)) {

          $tree_id_main_41 = $row_main_41['tree_id'];

          $group_number_main_41 = $row_main_41['group_number'];

          $member_no_main_41 = $row_main_41['member_no'];

          $sponsor_no_main_41 = $row_main_41['sponsor_no'];

          $level_no_main_41 = $row_main_41['level_no'];

          $relation_ship_no_main_41 = $row_main_41['relation_ship_no'];

          $x_position_main_41 = $row_main_41['x_position'];

        }



        if ($check_level_41 > 0) {



        $select_query_total_x41 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_41}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x41 = mysqli_query($con,$select_query_total_x41);

          while($row_total_x41 = mysqli_fetch_array($run_total_x41)){

                $total_x41 = $row_total_x41['SUM(product_amount)'];

          }



          $select_query_total_x41a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_41}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x41a = mysqli_query($con,$select_query_total_x41a);

          while($row_total_x41a = mysqli_fetch_array($run_total_x41a)){

                $total_x41a_1 = $row_total_x41a['SUM(roi_amount)'];





                

          }

          $total_x41a = $total_x41a_1+$total_x41;



          $select_query_growth_41 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_41}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_41 = mysqli_query($con,$select_query_growth_41);

          $check_level_growth_41 = mysqli_num_rows($run_growth_41);



          if ($check_level_growth_41 == 0) {

             $total_cur_41 = $total_x41a_1+$total_x41;

             $growth_leg_41=0;

          }

          else {

            $total_cur_41 = 0;

            $growth_leg_41=1;

          }





        }else {



          $total_x41 =0;

             $total_x41a=0;

             $total_cur_41 = 0;

             $growth_leg_41=0;



        }



        $select_query_main_42 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='42' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_42 = mysqli_query($con,$select_query_main_42);

          $check_level_42 = mysqli_num_rows($run_main_42);

          while ($row_main_42 = mysqli_fetch_array($run_main_42)) {

          $tree_id_main_42 = $row_main_42['tree_id'];

          $group_number_main_42 = $row_main_42['group_number'];

          $member_no_main_42 = $row_main_42['member_no'];

          $sponsor_no_main_42 = $row_main_42['sponsor_no'];

          $level_no_main_42 = $row_main_42['level_no'];

          $relation_ship_no_main_42 = $row_main_42['relation_ship_no'];

          $x_position_main_42 = $row_main_42['x_position'];

        }



        if ($check_level_42 > 0) {



        $select_query_total_x42 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_42}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x42 = mysqli_query($con,$select_query_total_x42);

          while($row_total_x42 = mysqli_fetch_array($run_total_x42)){

                $total_x42 = $row_total_x42['SUM(product_amount)'];

          }



          $select_query_total_x42a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_42}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x42a = mysqli_query($con,$select_query_total_x42a);

          while($row_total_x42a = mysqli_fetch_array($run_total_x42a)){

                $total_x42a_1 = $row_total_x42a['SUM(roi_amount)'];





                

          }

          $total_x42a = $total_x42a_1+$total_x42;



          $select_query_growth_42 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_42}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_42 = mysqli_query($con,$select_query_growth_42);

          $check_level_growth_42 = mysqli_num_rows($run_growth_42);



          if ($check_level_growth_42 == 0) {

             $total_cur_42 = $total_x42a_1+$total_x42;

             $growth_leg_42=0;

          }

          else {

            $total_cur_42 = 0;

            $growth_leg_42=1;

          }





        }else {



          $total_x42 =0;

             $total_x42a=0;

             $total_cur_42 = 0;

             $growth_leg_42=0;



        }



        $select_query_main_43 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='43' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_43 = mysqli_query($con,$select_query_main_43);

          $check_level_43 = mysqli_num_rows($run_main_43);

          while ($row_main_43 = mysqli_fetch_array($run_main_43)) {

          $tree_id_main_43 = $row_main_43['tree_id'];

          $group_number_main_43 = $row_main_43['group_number'];

          $member_no_main_43 = $row_main_43['member_no'];

          $sponsor_no_main_43 = $row_main_43['sponsor_no'];

          $level_no_main_43 = $row_main_43['level_no'];

          $relation_ship_no_main_43 = $row_main_43['relation_ship_no'];

          $x_position_main_43 = $row_main_43['x_position'];

        }



        if ($check_level_43 > 0) {



        $select_query_total_x43 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_43}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x43 = mysqli_query($con,$select_query_total_x43);

          while($row_total_x43 = mysqli_fetch_array($run_total_x43)){

                $total_x43 = $row_total_x43['SUM(product_amount)'];

          }



          $select_query_total_x43a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_43}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x43a = mysqli_query($con,$select_query_total_x43a);

          while($row_total_x43a = mysqli_fetch_array($run_total_x43a)){

                $total_x43a_1 = $row_total_x43a['SUM(roi_amount)'];





                

          }

          $total_x43a = $total_x43a_1+$total_x43;



          $select_query_growth_43 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_43}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_43 = mysqli_query($con,$select_query_growth_43);

          $check_level_growth_43 = mysqli_num_rows($run_growth_43);



          if ($check_level_growth_43 == 0) {

             $total_cur_43 = $total_x43a_1+$total_x43;

             $growth_leg_43=0;

          }

          else {

            $total_cur_43 = 0;

            $growth_leg_43=1;

          }





        }else {



          $total_x43 =0;

             $total_x43a=0;

             $total_cur_43 = 0;

             $growth_leg_43=0;



        }



        $select_query_main_44 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='44' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_44 = mysqli_query($con,$select_query_main_44);

          $check_level_44 = mysqli_num_rows($run_main_44);

          while ($row_main_44 = mysqli_fetch_array($run_main_44)) {

          $tree_id_main_44 = $row_main_44['tree_id'];

          $group_number_main_44 = $row_main_44['group_number'];

          $member_no_main_44 = $row_main_44['member_no'];

          $sponsor_no_main_44 = $row_main_44['sponsor_no'];

          $level_no_main_44 = $row_main_44['level_no'];

          $relation_ship_no_main_44 = $row_main_44['relation_ship_no'];

          $x_position_main_44 = $row_main_44['x_position'];

        }



        if ($check_level_44 > 0) {



        $select_query_total_x44 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_44}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x44 = mysqli_query($con,$select_query_total_x44);

          while($row_total_x44 = mysqli_fetch_array($run_total_x44)){

                $total_x44 = $row_total_x44['SUM(product_amount)'];

          }



          $select_query_total_x44a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_44}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x44a = mysqli_query($con,$select_query_total_x44a);

          while($row_total_x44a = mysqli_fetch_array($run_total_x44a)){

                $total_x44a_1 = $row_total_x44a['SUM(roi_amount)'];





                

          }

          $total_x44a = $total_x44a_1+$total_x44;



          $select_query_growth_44 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_44}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_44 = mysqli_query($con,$select_query_growth_44);

          $check_level_growth_44 = mysqli_num_rows($run_growth_44);



          if ($check_level_growth_44 == 0) {

             $total_cur_44 = $total_x44a_1+$total_x44;

             $growth_leg_44=0;

          }

          else {

            $total_cur_44 = 0;

            $growth_leg_44=1;

          }





        }else {



          $total_x44 =0;

             $total_x44a=0;

             $total_cur_44 = 0;

             $growth_leg_44=0;



        }



        $select_query_main_45 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='45' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_45 = mysqli_query($con,$select_query_main_45);

          $check_level_45 = mysqli_num_rows($run_main_45);

          while ($row_main_45 = mysqli_fetch_array($run_main_45)) {

          $tree_id_main_45 = $row_main_45['tree_id'];

          $group_number_main_45 = $row_main_45['group_number'];

          $member_no_main_45 = $row_main_45['member_no'];

          $sponsor_no_main_45 = $row_main_45['sponsor_no'];

          $level_no_main_45 = $row_main_45['level_no'];

          $relation_ship_no_main_45 = $row_main_45['relation_ship_no'];

          $x_position_main_45 = $row_main_45['x_position'];

        }



        if ($check_level_45 > 0) {



        $select_query_total_x45 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_45}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x45 = mysqli_query($con,$select_query_total_x45);

          while($row_total_x45 = mysqli_fetch_array($run_total_x45)){

                $total_x45 = $row_total_x45['SUM(product_amount)'];

          }



          $select_query_total_x45a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_45}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x45a = mysqli_query($con,$select_query_total_x45a);

          while($row_total_x45a = mysqli_fetch_array($run_total_x45a)){

                $total_x45a_1 = $row_total_x45a['SUM(roi_amount)'];





                

          }

          $total_x45a = $total_x45a_1+$total_x45;



          $select_query_growth_45 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_45}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_45 = mysqli_query($con,$select_query_growth_45);

          $check_level_growth_45 = mysqli_num_rows($run_growth_45);



          if ($check_level_growth_45 == 0) {

             $total_cur_45 = $total_x45a_1+$total_x45;

             $growth_leg_45=0;

          }

          else {

            $total_cur_45 = 0;

            $growth_leg_45=1;

          }





        }else {



          $total_x45 =0;

             $total_x45a=0;

             $total_cur_45 = 0;

             $growth_leg_45=0;



        }



        $select_query_main_46 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='46' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_46 = mysqli_query($con,$select_query_main_46);

          $check_level_46 = mysqli_num_rows($run_main_46);

          while ($row_main_46 = mysqli_fetch_array($run_main_46)) {

          $tree_id_main_46 = $row_main_46['tree_id'];

          $group_number_main_46 = $row_main_46['group_number'];

          $member_no_main_46 = $row_main_46['member_no'];

          $sponsor_no_main_46 = $row_main_46['sponsor_no'];

          $level_no_main_46 = $row_main_46['level_no'];

          $relation_ship_no_main_46 = $row_main_46['relation_ship_no'];

          $x_position_main_46 = $row_main_46['x_position'];

        }



        if ($check_level_46 > 0) {



        $select_query_total_x46 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_46}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x46 = mysqli_query($con,$select_query_total_x46);

          while($row_total_x46 = mysqli_fetch_array($run_total_x46)){

                $total_x46 = $row_total_x46['SUM(product_amount)'];

          }



          $select_query_total_x46a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_46}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x46a = mysqli_query($con,$select_query_total_x46a);

          while($row_total_x46a = mysqli_fetch_array($run_total_x46a)){

                $total_x46a_1 = $row_total_x46a['SUM(roi_amount)'];





                

          }

          $total_x46a = $total_x46a_1+$total_x46;



          $select_query_growth_46 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_46}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_46 = mysqli_query($con,$select_query_growth_46);

          $check_level_growth_46 = mysqli_num_rows($run_growth_46);



          if ($check_level_growth_46 == 0) {

             $total_cur_46 = $total_x46a_1+$total_x46;

             $growth_leg_46=0;

          }

          else {

            $total_cur_46 = 0;

            $growth_leg_46=1;

          }





        }else {



          $total_x46 =0;

             $total_x46a=0;

             $total_cur_46 = 0;

             $growth_leg_46=0;



        }



        $select_query_main_47 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='47' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_47 = mysqli_query($con,$select_query_main_47);

          $check_level_47 = mysqli_num_rows($run_main_47);

          while ($row_main_47 = mysqli_fetch_array($run_main_47)) {

          $tree_id_main_47 = $row_main_47['tree_id'];

          $group_number_main_47 = $row_main_47['group_number'];

          $member_no_main_47 = $row_main_47['member_no'];

          $sponsor_no_main_47 = $row_main_47['sponsor_no'];

          $level_no_main_47 = $row_main_47['level_no'];

          $relation_ship_no_main_47 = $row_main_47['relation_ship_no'];

          $x_position_main_47 = $row_main_47['x_position'];

        }



        if ($check_level_47 > 0) {



        $select_query_total_x47 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_47}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x47 = mysqli_query($con,$select_query_total_x47);

          while($row_total_x47 = mysqli_fetch_array($run_total_x47)){

                $total_x47 = $row_total_x47['SUM(product_amount)'];

          }



          $select_query_total_x47a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_47}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x47a = mysqli_query($con,$select_query_total_x47a);

          while($row_total_x47a = mysqli_fetch_array($run_total_x47a)){

                $total_x47a_1 = $row_total_x47a['SUM(roi_amount)'];





                

          }

          $total_x47a = $total_x47a_1+$total_x47;



          $select_query_growth_47 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_47}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_47 = mysqli_query($con,$select_query_growth_47);

          $check_level_growth_47 = mysqli_num_rows($run_growth_47);



          if ($check_level_growth_47 == 0) {

             $total_cur_47 = $total_x47a_1+$total_x47;

             $growth_leg_47=0;

          }

          else {

            $total_cur_47 = 0;

            $growth_leg_47=1;

          }





        }else {



          $total_x47 =0;

             $total_x47a=0;

             $total_cur_47 = 0;

             $growth_leg_47=0;



        }



        $select_query_main_48 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='48' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_48 = mysqli_query($con,$select_query_main_48);

          $check_level_48 = mysqli_num_rows($run_main_48);

          while ($row_main_48 = mysqli_fetch_array($run_main_48)) {

          $tree_id_main_48 = $row_main_48['tree_id'];

          $group_number_main_48 = $row_main_48['group_number'];

          $member_no_main_48 = $row_main_48['member_no'];

          $sponsor_no_main_48 = $row_main_48['sponsor_no'];

          $level_no_main_48 = $row_main_48['level_no'];

          $relation_ship_no_main_48 = $row_main_48['relation_ship_no'];

          $x_position_main_48 = $row_main_48['x_position'];

        }



        if ($check_level_48 > 0) {



        $select_query_total_x48 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_48}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x48 = mysqli_query($con,$select_query_total_x48);

          while($row_total_x48 = mysqli_fetch_array($run_total_x48)){

                $total_x48 = $row_total_x48['SUM(product_amount)'];

          }



          $select_query_total_x48a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_48}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x48a = mysqli_query($con,$select_query_total_x48a);

          while($row_total_x48a = mysqli_fetch_array($run_total_x48a)){

                $total_x48a_1 = $row_total_x48a['SUM(roi_amount)'];





                

          }

          $total_x48a = $total_x48a_1+$total_x48;



          $select_query_growth_48 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_48}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_48 = mysqli_query($con,$select_query_growth_48);

          $check_level_growth_48 = mysqli_num_rows($run_growth_48);



          if ($check_level_growth_48 == 0) {

             $total_cur_48 = $total_x48a_1+$total_x48;

             $growth_leg_48=0;

          }

          else {

            $total_cur_48 = 0;

            $growth_leg_48=1;

          }





        }else {



          $total_x48 =0;

             $total_x48a=0;

             $total_cur_48 = 0;

             $growth_leg_48=0;



        }



        $select_query_main_49 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='49' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_49 = mysqli_query($con,$select_query_main_49);

          $check_level_49 = mysqli_num_rows($run_main_49);

          while ($row_main_49 = mysqli_fetch_array($run_main_49)) {

          $tree_id_main_49 = $row_main_49['tree_id'];

          $group_number_main_49 = $row_main_49['group_number'];

          $member_no_main_49 = $row_main_49['member_no'];

          $sponsor_no_main_49 = $row_main_49['sponsor_no'];

          $level_no_main_49 = $row_main_49['level_no'];

          $relation_ship_no_main_49 = $row_main_49['relation_ship_no'];

          $x_position_main_49 = $row_main_49['x_position'];

        }



        if ($check_level_49 > 0) {



        $select_query_total_x49 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_49}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x49 = mysqli_query($con,$select_query_total_x49);

          while($row_total_x49 = mysqli_fetch_array($run_total_x49)){

                $total_x49 = $row_total_x49['SUM(product_amount)'];

          }



          $select_query_total_x49a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_49}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x49a = mysqli_query($con,$select_query_total_x49a);

          while($row_total_x49a = mysqli_fetch_array($run_total_x49a)){

                $total_x49a_1 = $row_total_x49a['SUM(roi_amount)'];





                

          }

          $total_x49a = $total_x49a_1+$total_x49;



          $select_query_growth_49 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_49}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_49 = mysqli_query($con,$select_query_growth_49);

          $check_level_growth_49 = mysqli_num_rows($run_growth_49);



          if ($check_level_growth_49 == 0) {

             $total_cur_49 = $total_x49a_1+$total_x49;

             $growth_leg_49=0;

          }

          else {

            $total_cur_49 = 0;

            $growth_leg_49=1;

          }





        }else {



          $total_x49 =0;

             $total_x49a=0;

             $total_cur_49 = 0;

             $growth_leg_49=0;



        }



        $select_query_main_50 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='50' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_50 = mysqli_query($con,$select_query_main_50);

          $check_level_50 = mysqli_num_rows($run_main_50);

          while ($row_main_50 = mysqli_fetch_array($run_main_50)) {

          $tree_id_main_50 = $row_main_50['tree_id'];

          $group_number_main_50 = $row_main_50['group_number'];

          $member_no_main_50 = $row_main_50['member_no'];

          $sponsor_no_main_50 = $row_main_50['sponsor_no'];

          $level_no_main_50 = $row_main_50['level_no'];

          $relation_ship_no_main_50 = $row_main_50['relation_ship_no'];

          $x_position_main_50 = $row_main_50['x_position'];

        }



        if ($check_level_50 > 0) {



        $select_query_total_x50 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_50}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x50 = mysqli_query($con,$select_query_total_x50);

          while($row_total_x50 = mysqli_fetch_array($run_total_x50)){

                $total_x50 = $row_total_x50['SUM(product_amount)'];

          }



          $select_query_total_x50a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_50}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x50a = mysqli_query($con,$select_query_total_x50a);

          while($row_total_x50a = mysqli_fetch_array($run_total_x50a)){

                $total_x50a_1 = $row_total_x50a['SUM(roi_amount)'];





                

          }

          $total_x50a = $total_x50a_1+$total_x50;



          $select_query_growth_50 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_50}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_50 = mysqli_query($con,$select_query_growth_50);

          $check_level_growth_50 = mysqli_num_rows($run_growth_50);



          if ($check_level_growth_50 == 0) {

             $total_cur_50 = $total_x50a_1+$total_x50;

             $growth_leg_50=0;

          }

          else {

            $total_cur_50 = 0;

            $growth_leg_50=1;

          }





        }else {



          $total_x50 =0;

             $total_x50a=0;

             $total_cur_50 = 0;

             $growth_leg_50=0;



        }



        $select_query_main_51 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='51' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_51 = mysqli_query($con,$select_query_main_51);

          $check_level_51 = mysqli_num_rows($run_main_51);

          while ($row_main_51 = mysqli_fetch_array($run_main_51)) {

          $tree_id_main_51 = $row_main_51['tree_id'];

          $group_number_main_51 = $row_main_51['group_number'];

          $member_no_main_51 = $row_main_51['member_no'];

          $sponsor_no_main_51 = $row_main_51['sponsor_no'];

          $level_no_main_51 = $row_main_51['level_no'];

          $relation_ship_no_main_51 = $row_main_51['relation_ship_no'];

          $x_position_main_51 = $row_main_51['x_position'];

        }



        if ($check_level_51 > 0) {



        $select_query_total_x51 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_51}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x51 = mysqli_query($con,$select_query_total_x51);

          while($row_total_x51 = mysqli_fetch_array($run_total_x51)){

                $total_x51 = $row_total_x51['SUM(product_amount)'];

          }



          $select_query_total_x51a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_51}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x51a = mysqli_query($con,$select_query_total_x51a);

          while($row_total_x51a = mysqli_fetch_array($run_total_x51a)){

                $total_x51a_1 = $row_total_x51a['SUM(roi_amount)'];





                

          }

          $total_x51a = $total_x51a_1+$total_x51;



          $select_query_growth_51 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_51}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_51 = mysqli_query($con,$select_query_growth_51);

          $check_level_growth_51 = mysqli_num_rows($run_growth_51);



          if ($check_level_growth_51 == 0) {

             $total_cur_51 = $total_x51a_1+$total_x51;

             $growth_leg_51=0;

          }

          else {

            $total_cur_51 = 0;

            $growth_leg_51=1;

          }





        }else {



          $total_x51 =0;

             $total_x51a=0;

             $total_cur_51 = 0;

             $growth_leg_51=0;



        }



        $select_query_main_52 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='52' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_52 = mysqli_query($con,$select_query_main_52);

          $check_level_52 = mysqli_num_rows($run_main_52);

          while ($row_main_52 = mysqli_fetch_array($run_main_52)) {

          $tree_id_main_52 = $row_main_52['tree_id'];

          $group_number_main_52 = $row_main_52['group_number'];

          $member_no_main_52 = $row_main_52['member_no'];

          $sponsor_no_main_52 = $row_main_52['sponsor_no'];

          $level_no_main_52 = $row_main_52['level_no'];

          $relation_ship_no_main_52 = $row_main_52['relation_ship_no'];

          $x_position_main_52 = $row_main_52['x_position'];

        }



        if ($check_level_52 > 0) {



        $select_query_total_x52 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_52}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x52 = mysqli_query($con,$select_query_total_x52);

          while($row_total_x52 = mysqli_fetch_array($run_total_x52)){

                $total_x52 = $row_total_x52['SUM(product_amount)'];

          }



          $select_query_total_x52a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_52}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x52a = mysqli_query($con,$select_query_total_x52a);

          while($row_total_x52a = mysqli_fetch_array($run_total_x52a)){

                $total_x52a_1 = $row_total_x52a['SUM(roi_amount)'];





                

          }

          $total_x52a = $total_x52a_1+$total_x52;



          $select_query_growth_52 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_52}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_52 = mysqli_query($con,$select_query_growth_52);

          $check_level_growth_52 = mysqli_num_rows($run_growth_52);



          if ($check_level_growth_52 == 0) {

             $total_cur_52 = $total_x52a_1+$total_x52;

             $growth_leg_52=0;

          }

          else {

            $total_cur_52 = 0;

            $growth_leg_52=1;

          }





        }else {



          $total_x52 =0;

             $total_x52a=0;

             $total_cur_52 = 0;

             $growth_leg_52=0;



        }



        $select_query_main_53 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='53' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_53 = mysqli_query($con,$select_query_main_53);

          $check_level_53 = mysqli_num_rows($run_main_53);

          while ($row_main_53 = mysqli_fetch_array($run_main_53)) {

          $tree_id_main_53 = $row_main_53['tree_id'];

          $group_number_main_53 = $row_main_53['group_number'];

          $member_no_main_53 = $row_main_53['member_no'];

          $sponsor_no_main_53 = $row_main_53['sponsor_no'];

          $level_no_main_53 = $row_main_53['level_no'];

          $relation_ship_no_main_53 = $row_main_53['relation_ship_no'];

          $x_position_main_53 = $row_main_53['x_position'];

        }



        if ($check_level_53 > 0) {



        $select_query_total_x53 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_53}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x53 = mysqli_query($con,$select_query_total_x53);

          while($row_total_x53 = mysqli_fetch_array($run_total_x53)){

                $total_x53 = $row_total_x53['SUM(product_amount)'];

          }



          $select_query_total_x53a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_53}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x53a = mysqli_query($con,$select_query_total_x53a);

          while($row_total_x53a = mysqli_fetch_array($run_total_x53a)){

                $total_x53a_1 = $row_total_x53a['SUM(roi_amount)'];





                

          }

          $total_x53a = $total_x53a_1+$total_x53;



          $select_query_growth_53 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_53}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_53 = mysqli_query($con,$select_query_growth_53);

          $check_level_growth_53 = mysqli_num_rows($run_growth_53);



          if ($check_level_growth_53 == 0) {

             $total_cur_53 = $total_x53a_1+$total_x53;

             $growth_leg_53=0;

          }

          else {

            $total_cur_53 = 0;

            $growth_leg_53=1;

          }





        }else {



          $total_x53 =0;

             $total_x53a=0;

             $total_cur_53 = 0;

             $growth_leg_53=0;



        }



        $select_query_main_54 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='54' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_54 = mysqli_query($con,$select_query_main_54);

          $check_level_54 = mysqli_num_rows($run_main_54);

          while ($row_main_54 = mysqli_fetch_array($run_main_54)) {

          $tree_id_main_54 = $row_main_54['tree_id'];

          $group_number_main_54 = $row_main_54['group_number'];

          $member_no_main_54 = $row_main_54['member_no'];

          $sponsor_no_main_54 = $row_main_54['sponsor_no'];

          $level_no_main_54 = $row_main_54['level_no'];

          $relation_ship_no_main_54 = $row_main_54['relation_ship_no'];

          $x_position_main_54 = $row_main_54['x_position'];

        }



        if ($check_level_54 > 0) {



        $select_query_total_x54 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_54}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x54 = mysqli_query($con,$select_query_total_x54);

          while($row_total_x54 = mysqli_fetch_array($run_total_x54)){

                $total_x54 = $row_total_x54['SUM(product_amount)'];

          }



          $select_query_total_x54a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_54}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x54a = mysqli_query($con,$select_query_total_x54a);

          while($row_total_x54a = mysqli_fetch_array($run_total_x54a)){

                $total_x54a_1 = $row_total_x54a['SUM(roi_amount)'];





                

          }

          $total_x54a = $total_x54a_1+$total_x54;



          $select_query_growth_54 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_54}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_54 = mysqli_query($con,$select_query_growth_54);

          $check_level_growth_54 = mysqli_num_rows($run_growth_54);



          if ($check_level_growth_54 == 0) {

             $total_cur_54 = $total_x54a_1+$total_x54;

             $growth_leg_54=0;

          }

          else {

            $total_cur_54 = 0;

            $growth_leg_54=1;

          }





        }else {



          $total_x54 =0;

             $total_x54a=0;

             $total_cur_54 = 0;

             $growth_leg_54=0;



        }



        $select_query_main_55 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='55' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_55 = mysqli_query($con,$select_query_main_55);

          $check_level_55 = mysqli_num_rows($run_main_55);

          while ($row_main_55 = mysqli_fetch_array($run_main_55)) {

          $tree_id_main_55 = $row_main_55['tree_id'];

          $group_number_main_55 = $row_main_55['group_number'];

          $member_no_main_55 = $row_main_55['member_no'];

          $sponsor_no_main_55 = $row_main_55['sponsor_no'];

          $level_no_main_55 = $row_main_55['level_no'];

          $relation_ship_no_main_55 = $row_main_55['relation_ship_no'];

          $x_position_main_55 = $row_main_55['x_position'];

        }



        if ($check_level_55 > 0) {



        $select_query_total_x55 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_55}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x55 = mysqli_query($con,$select_query_total_x55);

          while($row_total_x55 = mysqli_fetch_array($run_total_x55)){

                $total_x55 = $row_total_x55['SUM(product_amount)'];

          }



          $select_query_total_x55a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_55}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x55a = mysqli_query($con,$select_query_total_x55a);

          while($row_total_x55a = mysqli_fetch_array($run_total_x55a)){

                $total_x55a_1 = $row_total_x55a['SUM(roi_amount)'];





                

          }

          $total_x55a = $total_x55a_1+$total_x55;



          $select_query_growth_55 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_55}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_55 = mysqli_query($con,$select_query_growth_55);

          $check_level_growth_55 = mysqli_num_rows($run_growth_55);



          if ($check_level_growth_55 == 0) {

             $total_cur_55 = $total_x55a_1+$total_x55;

             $growth_leg_55=0;

          }

          else {

            $total_cur_55 = 0;

            $growth_leg_55=1;

          }





        }else {



          $total_x55 =0;

             $total_x55a=0;

             $total_cur_55 = 0;

             $growth_leg_55=0;



        }



        $select_query_main_56 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='56' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_56 = mysqli_query($con,$select_query_main_56);

          $check_level_56 = mysqli_num_rows($run_main_56);

          while ($row_main_56 = mysqli_fetch_array($run_main_56)) {

          $tree_id_main_56 = $row_main_56['tree_id'];

          $group_number_main_56 = $row_main_56['group_number'];

          $member_no_main_56 = $row_main_56['member_no'];

          $sponsor_no_main_56 = $row_main_56['sponsor_no'];

          $level_no_main_56 = $row_main_56['level_no'];

          $relation_ship_no_main_56 = $row_main_56['relation_ship_no'];

          $x_position_main_56 = $row_main_56['x_position'];

        }



        if ($check_level_56 > 0) {



        $select_query_total_x56 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_56}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x56 = mysqli_query($con,$select_query_total_x56);

          while($row_total_x56 = mysqli_fetch_array($run_total_x56)){

                $total_x56 = $row_total_x56['SUM(product_amount)'];

          }



          $select_query_total_x56a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_56}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x56a = mysqli_query($con,$select_query_total_x56a);

          while($row_total_x56a = mysqli_fetch_array($run_total_x56a)){

                $total_x56a_1 = $row_total_x56a['SUM(roi_amount)'];





                

          }

          $total_x56a = $total_x56a_1+$total_x56;



          $select_query_growth_56 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_56}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_56 = mysqli_query($con,$select_query_growth_56);

          $check_level_growth_56 = mysqli_num_rows($run_growth_56);



          if ($check_level_growth_56 == 0) {

             $total_cur_56 = $total_x56a_1+$total_x56;

             $growth_leg_56=0;

          }

          else {

            $total_cur_56 = 0;

            $growth_leg_56=1;

          }





        }else {



          $total_x56 =0;

             $total_x56a=0;

             $total_cur_56 = 0;

             $growth_leg_56=0;



        }



        $select_query_main_57 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='57' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_57 = mysqli_query($con,$select_query_main_57);

          $check_level_57 = mysqli_num_rows($run_main_57);

          while ($row_main_57 = mysqli_fetch_array($run_main_57)) {

          $tree_id_main_57 = $row_main_57['tree_id'];

          $group_number_main_57 = $row_main_57['group_number'];

          $member_no_main_57 = $row_main_57['member_no'];

          $sponsor_no_main_57 = $row_main_57['sponsor_no'];

          $level_no_main_57 = $row_main_57['level_no'];

          $relation_ship_no_main_57 = $row_main_57['relation_ship_no'];

          $x_position_main_57 = $row_main_57['x_position'];

        }



        if ($check_level_57 > 0) {



        $select_query_total_x57 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_57}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x57 = mysqli_query($con,$select_query_total_x57);

          while($row_total_x57 = mysqli_fetch_array($run_total_x57)){

                $total_x57 = $row_total_x57['SUM(product_amount)'];

          }



          $select_query_total_x57a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_57}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x57a = mysqli_query($con,$select_query_total_x57a);

          while($row_total_x57a = mysqli_fetch_array($run_total_x57a)){

                $total_x57a_1 = $row_total_x57a['SUM(roi_amount)'];





                

          }

          $total_x57a = $total_x57a_1+$total_x57;



          $select_query_growth_57 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_57}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_57 = mysqli_query($con,$select_query_growth_57);

          $check_level_growth_57 = mysqli_num_rows($run_growth_57);



          if ($check_level_growth_57 == 0) {

             $total_cur_57 = $total_x57a_1+$total_x57;

             $growth_leg_57=0;

          }

          else {

            $total_cur_57 = 0;

            $growth_leg_57=1;

          }





        }else {



          $total_x57 =0;

             $total_x57a=0;

             $total_cur_57 = 0;

             $growth_leg_57=0;



        }



        $select_query_main_58 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='58' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_58 = mysqli_query($con,$select_query_main_58);

          $check_level_58 = mysqli_num_rows($run_main_58);

          while ($row_main_58 = mysqli_fetch_array($run_main_58)) {

          $tree_id_main_58 = $row_main_58['tree_id'];

          $group_number_main_58 = $row_main_58['group_number'];

          $member_no_main_58 = $row_main_58['member_no'];

          $sponsor_no_main_58 = $row_main_58['sponsor_no'];

          $level_no_main_58 = $row_main_58['level_no'];

          $relation_ship_no_main_58 = $row_main_58['relation_ship_no'];

          $x_position_main_58 = $row_main_58['x_position'];

        }



        if ($check_level_58 > 0) {



        $select_query_total_x58 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_58}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x58 = mysqli_query($con,$select_query_total_x58);

          while($row_total_x58 = mysqli_fetch_array($run_total_x58)){

                $total_x58 = $row_total_x58['SUM(product_amount)'];

          }



          $select_query_total_x58a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_58}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x58a = mysqli_query($con,$select_query_total_x58a);

          while($row_total_x58a = mysqli_fetch_array($run_total_x58a)){

                $total_x58a_1 = $row_total_x58a['SUM(roi_amount)'];





                

          }

          $total_x58a = $total_x58a_1+$total_x58;



          $select_query_growth_58 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_58}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_58 = mysqli_query($con,$select_query_growth_58);

          $check_level_growth_58 = mysqli_num_rows($run_growth_58);



          if ($check_level_growth_58 == 0) {

             $total_cur_58 = $total_x58a_1+$total_x58;

             $growth_leg_58=0;

          }

          else {

            $total_cur_58 = 0;

            $growth_leg_58=1;

          }





        }else {



          $total_x58 =0;

             $total_x58a=0;

             $total_cur_58 = 0;

             $growth_leg_58=0;



        }



        $select_query_main_59 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='59' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_59 = mysqli_query($con,$select_query_main_59);

          $check_level_59 = mysqli_num_rows($run_main_59);

          while ($row_main_59 = mysqli_fetch_array($run_main_59)) {

          $tree_id_main_59 = $row_main_59['tree_id'];

          $group_number_main_59 = $row_main_59['group_number'];

          $member_no_main_59 = $row_main_59['member_no'];

          $sponsor_no_main_59 = $row_main_59['sponsor_no'];

          $level_no_main_59 = $row_main_59['level_no'];

          $relation_ship_no_main_59 = $row_main_59['relation_ship_no'];

          $x_position_main_59 = $row_main_59['x_position'];

        }



        if ($check_level_59 > 0) {



        $select_query_total_x59 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_59}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x59 = mysqli_query($con,$select_query_total_x59);

          while($row_total_x59 = mysqli_fetch_array($run_total_x59)){

                $total_x59 = $row_total_x59['SUM(product_amount)'];

          }



          $select_query_total_x59a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_59}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x59a = mysqli_query($con,$select_query_total_x59a);

          while($row_total_x59a = mysqli_fetch_array($run_total_x59a)){

                $total_x59a_1 = $row_total_x59a['SUM(roi_amount)'];





                

          }

          $total_x59a = $total_x59a_1+$total_x59;



          $select_query_growth_59 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_59}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_59 = mysqli_query($con,$select_query_growth_59);

          $check_level_growth_59 = mysqli_num_rows($run_growth_59);



          if ($check_level_growth_59 == 0) {

             $total_cur_59 = $total_x59a_1+$total_x59;

             $growth_leg_59=0;

          }

          else {

            $total_cur_59 = 0;

            $growth_leg_59=1;

          }





        }else {



          $total_x59 =0;

             $total_x59a=0;

             $total_cur_59 = 0;

             $growth_leg_59=0;



        }



        $select_query_main_60 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='60' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_60 = mysqli_query($con,$select_query_main_60);

          $check_level_60 = mysqli_num_rows($run_main_60);

          while ($row_main_60 = mysqli_fetch_array($run_main_60)) {

          $tree_id_main_60 = $row_main_60['tree_id'];

          $group_number_main_60 = $row_main_60['group_number'];

          $member_no_main_60 = $row_main_60['member_no'];

          $sponsor_no_main_60 = $row_main_60['sponsor_no'];

          $level_no_main_60 = $row_main_60['level_no'];

          $relation_ship_no_main_60 = $row_main_60['relation_ship_no'];

          $x_position_main_60 = $row_main_60['x_position'];

        }



        if ($check_level_60 > 0) {



        $select_query_total_x60 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_60}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x60 = mysqli_query($con,$select_query_total_x60);

          while($row_total_x60 = mysqli_fetch_array($run_total_x60)){

                $total_x60 = $row_total_x60['SUM(product_amount)'];

          }



          $select_query_total_x60a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_60}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x60a = mysqli_query($con,$select_query_total_x60a);

          while($row_total_x60a = mysqli_fetch_array($run_total_x60a)){

                $total_x60a_1 = $row_total_x60a['SUM(roi_amount)'];





                

          }

          $total_x60a = $total_x60a_1+$total_x60;



          $select_query_growth_60 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_60}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_60 = mysqli_query($con,$select_query_growth_60);

          $check_level_growth_60 = mysqli_num_rows($run_growth_60);



          if ($check_level_growth_60 == 0) {

             $total_cur_60 = $total_x60a_1+$total_x60;

             $growth_leg_60=0;

          }

          else {

            $total_cur_60 = 0;

            $growth_leg_60=1;

          }





        }else {



          $total_x60 =0;

             $total_x60a=0;

             $total_cur_60 = 0;

             $growth_leg_60=0;



        }



        $select_query_main_61 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='61' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_61 = mysqli_query($con,$select_query_main_61);

          $check_level_61 = mysqli_num_rows($run_main_61);

          while ($row_main_61 = mysqli_fetch_array($run_main_61)) {

          $tree_id_main_61 = $row_main_61['tree_id'];

          $group_number_main_61 = $row_main_61['group_number'];

          $member_no_main_61 = $row_main_61['member_no'];

          $sponsor_no_main_61 = $row_main_61['sponsor_no'];

          $level_no_main_61 = $row_main_61['level_no'];

          $relation_ship_no_main_61 = $row_main_61['relation_ship_no'];

          $x_position_main_61 = $row_main_61['x_position'];

        }



        if ($check_level_61 > 0) {



        $select_query_total_x61 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_61}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x61 = mysqli_query($con,$select_query_total_x61);

          while($row_total_x61 = mysqli_fetch_array($run_total_x61)){

                $total_x61 = $row_total_x61['SUM(product_amount)'];

          }



          $select_query_total_x61a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_61}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x61a = mysqli_query($con,$select_query_total_x61a);

          while($row_total_x61a = mysqli_fetch_array($run_total_x61a)){

                $total_x61a_1 = $row_total_x61a['SUM(roi_amount)'];





                

          }

          $total_x61a = $total_x61a_1+$total_x61;



          $select_query_growth_61 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_61}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_61 = mysqli_query($con,$select_query_growth_61);

          $check_level_growth_61 = mysqli_num_rows($run_growth_61);



          if ($check_level_growth_61 == 0) {

             $total_cur_61 = $total_x61a_1+$total_x61;

             $growth_leg_61=0;

          }

          else {

            $total_cur_61 = 0;

            $growth_leg_61=1;

          }





        }else {



          $total_x61 =0;

             $total_x61a=0;

             $total_cur_61 = 0;

             $growth_leg_61=0;



        }



        $select_query_main_62 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='62' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_62 = mysqli_query($con,$select_query_main_62);

          $check_level_62 = mysqli_num_rows($run_main_62);

          while ($row_main_62 = mysqli_fetch_array($run_main_62)) {

          $tree_id_main_62 = $row_main_62['tree_id'];

          $group_number_main_62 = $row_main_62['group_number'];

          $member_no_main_62 = $row_main_62['member_no'];

          $sponsor_no_main_62 = $row_main_62['sponsor_no'];

          $level_no_main_62 = $row_main_62['level_no'];

          $relation_ship_no_main_62 = $row_main_62['relation_ship_no'];

          $x_position_main_62 = $row_main_62['x_position'];

        }



        if ($check_level_62 > 0) {



        $select_query_total_x62 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_62}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x62 = mysqli_query($con,$select_query_total_x62);

          while($row_total_x62 = mysqli_fetch_array($run_total_x62)){

                $total_x62 = $row_total_x62['SUM(product_amount)'];

          }



          $select_query_total_x62a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_62}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x62a = mysqli_query($con,$select_query_total_x62a);

          while($row_total_x62a = mysqli_fetch_array($run_total_x62a)){

                $total_x62a_1 = $row_total_x62a['SUM(roi_amount)'];





                

          }

          $total_x62a = $total_x62a_1+$total_x62;



          $select_query_growth_62 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_62}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_62 = mysqli_query($con,$select_query_growth_62);

          $check_level_growth_62 = mysqli_num_rows($run_growth_62);



          if ($check_level_growth_62 == 0) {

             $total_cur_62 = $total_x62a_1+$total_x62;

             $growth_leg_62=0;

          }

          else {

            $total_cur_62 = 0;

            $growth_leg_62=1;

          }





        }else {



          $total_x62 =0;

             $total_x62a=0;

             $total_cur_62 = 0;

             $growth_leg_62=0;



        }



        $select_query_main_63 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='63' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_63 = mysqli_query($con,$select_query_main_63);

          $check_level_63 = mysqli_num_rows($run_main_63);

          while ($row_main_63 = mysqli_fetch_array($run_main_63)) {

          $tree_id_main_63 = $row_main_63['tree_id'];

          $group_number_main_63 = $row_main_63['group_number'];

          $member_no_main_63 = $row_main_63['member_no'];

          $sponsor_no_main_63 = $row_main_63['sponsor_no'];

          $level_no_main_63 = $row_main_63['level_no'];

          $relation_ship_no_main_63 = $row_main_63['relation_ship_no'];

          $x_position_main_63 = $row_main_63['x_position'];

        }



        if ($check_level_63 > 0) {



        $select_query_total_x63 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_63}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x63 = mysqli_query($con,$select_query_total_x63);

          while($row_total_x63 = mysqli_fetch_array($run_total_x63)){

                $total_x63 = $row_total_x63['SUM(product_amount)'];

          }



          $select_query_total_x63a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_63}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x63a = mysqli_query($con,$select_query_total_x63a);

          while($row_total_x63a = mysqli_fetch_array($run_total_x63a)){

                $total_x63a_1 = $row_total_x63a['SUM(roi_amount)'];





                

          }

          $total_x63a = $total_x63a_1+$total_x63;



          $select_query_growth_63 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_63}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_63 = mysqli_query($con,$select_query_growth_63);

          $check_level_growth_63 = mysqli_num_rows($run_growth_63);



          if ($check_level_growth_63 == 0) {

             $total_cur_63 = $total_x63a_1+$total_x63;

             $growth_leg_63=0;

          }

          else {

            $total_cur_63 = 0;

            $growth_leg_63=1;

          }





        }else {



          $total_x63 =0;

             $total_x63a=0;

             $total_cur_63 = 0;

             $growth_leg_63=0;



        }



        $select_query_main_64 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='64' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_64 = mysqli_query($con,$select_query_main_64);

          $check_level_64 = mysqli_num_rows($run_main_64);

          while ($row_main_64 = mysqli_fetch_array($run_main_64)) {

          $tree_id_main_64 = $row_main_64['tree_id'];

          $group_number_main_64 = $row_main_64['group_number'];

          $member_no_main_64 = $row_main_64['member_no'];

          $sponsor_no_main_64 = $row_main_64['sponsor_no'];

          $level_no_main_64 = $row_main_64['level_no'];

          $relation_ship_no_main_64 = $row_main_64['relation_ship_no'];

          $x_position_main_64 = $row_main_64['x_position'];

        }



        if ($check_level_64 > 0) {



        $select_query_total_x64 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_64}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x64 = mysqli_query($con,$select_query_total_x64);

          while($row_total_x64 = mysqli_fetch_array($run_total_x64)){

                $total_x64 = $row_total_x64['SUM(product_amount)'];

          }



          $select_query_total_x64a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_64}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x64a = mysqli_query($con,$select_query_total_x64a);

          while($row_total_x64a = mysqli_fetch_array($run_total_x64a)){

                $total_x64a_1 = $row_total_x64a['SUM(roi_amount)'];





                

          }

          $total_x64a = $total_x64a_1+$total_x64;



          $select_query_growth_64 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_64}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_64 = mysqli_query($con,$select_query_growth_64);

          $check_level_growth_64 = mysqli_num_rows($run_growth_64);



          if ($check_level_growth_64 == 0) {

             $total_cur_64 = $total_x64a_1+$total_x64;

             $growth_leg_64=0;

          }

          else {

            $total_cur_64 = 0;

            $growth_leg_64=1;

          }





        }else {



          $total_x64 =0;

             $total_x64a=0;

             $total_cur_64 = 0;

             $growth_leg_64=0;



        }



        $select_query_main_65 = "select * from roi_tree where group_number = '$group_number_main' AND x_position = '$x_position_main' AND y_position='65' AND relation_ship_no LIKE '%{$relation_ship_no_main}%' AND tree_id > '$tree_id_main'";

          $run_main_65 = mysqli_query($con,$select_query_main_65);

          $check_level_65 = mysqli_num_rows($run_main_65);

          while ($row_main_65 = mysqli_fetch_array($run_main_65)) {

          $tree_id_main_65 = $row_main_65['tree_id'];

          $group_number_main_65 = $row_main_65['group_number'];

          $member_no_main_65 = $row_main_65['member_no'];

          $sponsor_no_main_65 = $row_main_65['sponsor_no'];

          $level_no_main_65 = $row_main_65['level_no'];

          $relation_ship_no_main_65 = $row_main_65['relation_ship_no'];

          $x_position_main_65 = $row_main_65['x_position'];

        }



        if ($check_level_65 > 0) {



        $select_query_total_x65 = "select SUM(product_amount) from product_tree where relation_ship_no LIKE '%{$relation_ship_no_main_65}%' AND member_no <> '$member_no_main' AND product_no not in (".implode(',', $arr1_10a_pro).") AND status='0'";

          $run_total_x65 = mysqli_query($con,$select_query_total_x65);

          while($row_total_x65 = mysqli_fetch_array($run_total_x65)){

                $total_x65 = $row_total_x65['SUM(product_amount)'];

          }



          $select_query_total_x65a = "select SUM(roi_amount) from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_65}%' AND tree_id > '$tree_id_main' AND member_no not in (".implode(',', $arr1).")";

          $run_total_x65a = mysqli_query($con,$select_query_total_x65a);

          while($row_total_x65a = mysqli_fetch_array($run_total_x65a)){

                $total_x65a_1 = $row_total_x65a['SUM(roi_amount)'];





                

          }

          $total_x65a = $total_x65a_1+$total_x65;



          $select_query_growth_65 = "select * from roi_tree where relation_ship_no LIKE '%{$relation_ship_no_main_65}%' AND tree_id > '$tree_id_main' AND booster='2'";

          $run_growth_65 = mysqli_query($con,$select_query_growth_65);

          $check_level_growth_65 = mysqli_num_rows($run_growth_65);



          if ($check_level_growth_65 == 0) {

             $total_cur_65 = $total_x65a_1+$total_x65;

             $growth_leg_65=0;

          }

          else {

            $total_cur_65 = 0;

            $growth_leg_65=1;

          }





        }else {



          $total_x65 =0;

             $total_x65a=0;

             $total_cur_65 = 0;

             $growth_leg_65=0;



        }





         $total_grouwth_leg = $growth_leg_1+$growth_leg_2+$growth_leg_3+$growth_leg_4+$growth_leg_5+$growth_leg_6+$growth_leg_7+$growth_leg_8+$growth_leg_9+$growth_leg_10+$growth_leg_11+$growth_leg_12+$growth_leg_13+$growth_leg_14+$growth_leg_15+$growth_leg_16+$growth_leg_17+$growth_leg_18+$growth_leg_19+$growth_leg_20+$growth_leg_21+$growth_leg_22+$growth_leg_23+$growth_leg_24+$growth_leg_25+$growth_leg_26+$growth_leg_27+$growth_leg_28+$growth_leg_29+$growth_leg_30+$growth_leg_31+$growth_leg_32+$growth_leg_33+$growth_leg_34+$growth_leg_35+$growth_leg_36+$growth_leg_37+$growth_leg_38+$growth_leg_39+$growth_leg_40+$growth_leg_41+$growth_leg_42+$growth_leg_43+$growth_leg_44+$growth_leg_45+$growth_leg_46+$growth_leg_47+$growth_leg_48+$growth_leg_49+$growth_leg_50+$growth_leg_51+$growth_leg_52+$growth_leg_53+$growth_leg_54+$growth_leg_55+$growth_leg_56+$growth_leg_57+$growth_leg_58+$growth_leg_59+$growth_leg_60+$growth_leg_61+$growth_leg_62+$growth_leg_63+$growth_leg_64+$growth_leg_65;

             



             



             $total_single_leg = $personal_pv_join+$p_per_product_x1_10a;



             //total_percent_to_get







             //get level position20a amount



          $current_sv = $total_cur_1+$total_cur_2+$total_cur_3+$total_cur_4+$total_cur_6+$total_cur_7+$total_cur_8+$total_cur_9+$total_cur_10+$total_cur_11+$total_cur_12+$total_cur_13+$total_cur_14+$total_cur_15+$total_cur_16+$total_cur_17+$total_cur_18+$total_cur_19+$total_cur_20+$total_cur_21+$total_cur_22+$total_cur_23+$total_cur_24+$total_cur_25+$total_cur_26+$total_cur_27+$total_cur_28+$total_cur_29+$total_cur_30+$total_cur_5+$total_cur_5+$total_cur_31+$total_cur_32+$total_cur_33+$total_cur_34+$total_cur_35+$total_cur_36+$total_cur_37+$total_cur_38+$total_cur_39+$total_cur_40+$total_cur_41+$total_cur_42+$total_cur_43+$total_cur_44+$total_cur_45+$total_cur_46+$total_cur_47+$total_cur_48+$total_cur_49+$total_cur_50+$total_cur_51+$total_cur_52+$total_cur_53+$total_cur_54+$total_cur_55+$total_cur_56+$total_cur_57+$total_cur_58+$total_cur_59+$total_cur_60+$total_cur_61+$total_cur_62+$total_cur_63+$total_cur_64+$total_cur_65;



          $current_sv_final = $current_sv+$total_single_leg;









          // get calculation



          $total_personal_bv = $total_single_leg;



          $total_group_bv = $total_team_pv;



          $total_current_group_bv = $total_single_leg_current_view;





          $side_volume_total = $current_sv_final;



          // get calculation



          $date = date("Y-m-d"); 

          $year = date("Y"); 

          $month = date("m");





           if ($total_grouwth_leg > 0 && $booster == 2) {



                  mysqli_query($con,"update roi_tree set booster='0' where member_no='$member_no'");

                  mysqli_query($con,"update member set booster='0' where member_no='$member_no'"); 

                

              }



            





           



           

                  



           









 ?>









                               <?php } ?>

Anon7 - 2022
SCDN GOK