<?php
 $janfee='';
 $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='January'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='January' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $janfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $janfee='0';
    }
    
    //February
    $febfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='February'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='February' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $febfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $febfee='0';
    }
    
    //March
    $marfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='March'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='March' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $marfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $marfee='0';
    }
    
     //April
    $aprfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='April'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='April' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $aprfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $aprfee='0';
    }
    
     //May
    $mayfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='May'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='May' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $mayfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $mayfee='0';
    }
    
    
    
       //June
    $junfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='June'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='June' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $junfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $junfee='0';
    }
    
     //July
    $julyfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='July'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='July' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $julyfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $julyfee='0';
    }
    
    
     //August
    $augfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='August'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='August' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $augfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $augfee='0';
    }
    
    
    //September
    $sepfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='September'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='September' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $sepfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $sepfee='0';
    }
    
    
    //October
    $octfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='October'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='October' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $octfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $octfee='0';
    }
    
    
    //November
    $novfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='November'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='November' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $novfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $novfee='0';
    }
    
    
    //December
    $novfee='';
    
    $sql = mysqli_query($con,"SELECT * FROM feestatement where Year='$yr' AND Month='December'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(PaidAmount) FROM feestatement where Month ='December' AND Year='$yr'");
    while($row = $result->fetch_assoc()) 
    {
    $decfee=$row['sum(PaidAmount)'];
    }
    }else
    {
    $decfee='0';
    }
    
    ?>