以奇数MLM产生收入

时间:2019-03-21 16:12:26

标签: php mysql

我想在MLM中产生奇数个收入。

如果left = 2,right = 3,那么它应该产生收入...

但是当前代码是,如果left = 4,right = 1,那么它正在产生收入...

$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";
        }
    }
}

说明:我将左右值存储到变量中。作为$gettotalleft$gettotalright

1 个答案:

答案 0 :(得分:0)

如果要检查$ gettotalleft等于2和$ gettotalright等于3,则只需要:

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

如果这不是您想要的,则在说明问题时需要更加具体。