<?php
if(isset($_POST['id'])){
require_once('../../assets/config/config.php');
$obj=new Database();
$id=$_POST['id'];
$id="name='".$id."'";
$obj->select('course','*',null,$id,null,null);
$result=$obj->getResult();
$f="course_name='".$_POST['id']."'";

            $obj->select('fee','*',null,$f,null,null);
            $result1=$obj->getResult(); 
            $c=0;                                      
            foreach($result1 as list("amount"=>$amount))
            {
             $c=$c+$amount;
            }
    $result[0]['total_fee'] = $c;
    header('Content-type:application/json');
    echo json_encode($result);
}
?>