<?php
include("../../db.php");
//header("Access-Control-Allow-Origin: * ");

header('Content-Type: application/json');
          $class=$_REQUEST['class'];
          $section=$_REQUEST['section'];
	      
   	      $session=$_REQUEST['session'];
	      $type=$_REQUEST['type'];
	
	      
 $session=mysql_real_escape_string($session);
	 
 $allsubject=$db->getRows("select subject from subject where class='$class' and session='$session'");

$allstudent=$db->getRows("select idno, admissionno,name,fname,fincome,class,section,mobile from student where session='$session' and class='$class'  and  status=1  and issue_TC=0 order by name");	      
	      
	      
$i=0;
foreach($allstudent as $stu){$i++;


foreach($allsubject as $sub){
    
$examResultData=$db->getRow("select * from exammarks where school_id='1' and idno='".$stu["idno"]."' and type='$type' and subject='".$sub["subject"]."'");
//echo $ss="select * from exammarks where school_id='1' and idno='".$stu["idno"]."' and type='$type' and subject='".$sub["subject"]."'";

     
      $jsonp[]=array("idno"=>$examResultData['idno'],"sub_marks"=>array("subject"=>$examResultData['subject'],"obtain"=>$examResultData['obtain']));

}

}
	      