以奇数MLM生成收入

I want to generate income in odd numbers in MLM.

If left = 2 and right = 3 then it should generate income...

but current code is, if left = 4 and right = 1 then it is generating income...

$gettotalleft  = $class_database->getdata("paidleft", "id='$useridp'", "user"); 
$gettotalright = $class_database->getdata("paidright", "id='$useridp'", "user");    
$mincome=$gettotalleft+$gettotalright;  //Total LEft Right Child-----


if($mincome == 5){
    $incm=250;
    $TDate= date('Y-m-d');
    $ntp =$nsdp['Type'];
    $sql=mysqli_query($sql_conn,"insert into payment values('0','$useridp','$incm','Matching','','paid','','','','N/A','$TDate','$ntps')");
    if($sql){
        $ddhg =mysqli_fetch_array(mysqli_query($sql_conn,"select * from balance where userid='$useridp'"));
        $nbld =$ddhg['balance']+$incm;
        echo $nbld;
        mysqli_query($sql_conn,"update balance set balance='$nbld' where userid='$useridp'");
        }else{ 
            echo "not updated";
        }
    }
}

Explanation: I am storing left and right value into variable..as $gettotalleft and $gettotalright

If you want to check if $gettotalleft is equal 2 and $gettotalright is equal 3, you just need:

if($gettotalleft == 2 and $gettotalright == 3){
//do something
}

If this is not what you want, you need to be a lot more specific when explaining your question.