<?php
if(isset($_POST['state'])){
   require_once('../../assets/config/config.php');
   $obj=new Database();
   $id=$_POST['id'];
   $b=[];   
   if($_POST['state']=='course')
   {
      $id="student_id='".$id."'";
      $obj->select('students_course','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   } 
   else if($_POST['state']=='doc')
   {
      $id="student_id='".$id."'";
      $obj->select('students_documents','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   } 
   else if($_POST['state']=='info')
   {
      $id="student_id='".$id."'";
      $obj->select('students','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   }   
   else if($_POST['state']=='c_info')
   {
      $id="batch_no='".$id."'";
      $obj->select('students_course','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   }  
   else if($_POST['state']=='c_exam')
   {
      $id="batch_no='".$id."'";
      $obj->select('student_exam','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   }  
   else if($_POST['state']=='c_att')
   {
      $id="batch_no='".$id."'";
      $obj->select('students_attendence','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   } 
   else if($_POST['state']=='c_fee')
   {
      $id="batch_no='".$id."'";
      $obj->select('students_fee','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   } 
   else if($_POST['state']=='user_edit')
   {
      $id="id='".$_POST['id']."'";
      $obj->select('user','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   }
   else if($_POST['state']=='inventory_edit')
   {
      $id="f_id='".$_POST['id']."'";
      $obj->select('inventory','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   }
   else if($_POST['state']=='acourse_edit')
   {
      $id="f_id='".$_POST['id']."'";
      $obj->select('students_course','*',null,$id,null,null);
      $result=$obj->getResult();                              
      foreach($result as $row)
      {      
         array_push($b,$row);                
      }
   }
         header('Content-type:application/json');
         echo json_encode($b);
}
?>