<?php
 $janoth='';
 $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='January'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='January' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $janoth=$row['sum(Amount)'];
    }
    }else
    {
    $janoth='0';
    }
    
    //February
    $feboth='';
    
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='February'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='February' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $feboth=$row['sum(Amount)'];
    }
    }else
    {
    $feboth='0';
    }
    
    //March
    $maroth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='March'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='March' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $maroth=$row['sum(Amount)'];
    }
    }else
    {
    $maroth='0';
    }
    
     //April
    $aproth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='April'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='April' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $aproth=$row['sum(Amount)'];
    }
    }else
    {
    $aproth='0';
    }
    
    
     //May
    $mayoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='May'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='May' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $mayoth=$row['sum(Amount)'];
    }
    }else
    {
    $mayoth='0';
    }
    
    
     //June
    $junoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='June'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='June' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $junoth=$row['sum(Amount)'];
    }
    }else
    {
    $junoth='0';
    }
    
    //July
     $julyoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='July'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='July' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $julyoth=$row['sum(Amount)'];
    }
    }else
    {
    $julyoth='0';
    }
    
    
    //August
    $augoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='August'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='August' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $augoth=$row['sum(Amount)'];
    }
    }else
    {
    $augoth='0';
    }
    
    
    //September
    $sepoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='September'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='September' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $sepoth=$row['sum(Amount)'];
    }
    }else
    {
    $sepoth='0';
    }
    
    
    //October
    $octoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='October'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='October' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $octoth=$row['sum(Amount)'];
    }
    }else
    {
    $octoth='0';
    }
    
    //November
    $novoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='November'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='November' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $novoth=$row['sum(Amount)'];
    }
    }else
    {
    $novoth='0';
    }
    
    
    //December
    $decoth='';
    $sql = mysqli_query($con,"SELECT * FROM Otherincome where Year='$yr' AND Month='December'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(Amount) FROM Otherincome where Month ='December' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $decoth=$row['sum(Amount)'];
    }
    }else
    {
    $decoth='0';
    }
    
    ?>