  <?php
include("../../db.php");
header("Access-Control-Allow-Origin: * ");
header('Content-Type: application/json');
 
 
         $session=$_REQUEST['session'];
        // $session=mysql_real_escape_string($session);
	
	if(isset($_GET["class"]) && trim($_GET["class"])!=""){
		
			$conwhere.=" and class='".$_GET["class"]."' ";
		}
		if(isset($_GET["section"]) && trim($_GET["section"])!=""){
		
			$conwhere.=" and section='".$_GET["section"]."' ";
		}

$jsonn = [];

// $result_term = mysql_query("select name,class,fincome,section,photo from student where session='$session' $conwhere");
//   while ($rowt = mysql_fetch_assoc($result_term)) 	

    $result_term = $db->getRows("select name,class,fincome,section,photo from student where session='$session' $conwhere");
    foreach($result_term as $rowt)
	{
		 $jsonn[]=array("name"=>$rowt['name'],"class"=>$rowt['class'],"rollno"=>$rowt['fincome'],"section"=>$rowt['section'],"photo"=>"media/photo/".$rowt['photo']);      
	}
	
	    $json['status']=1;
		$json['msg']="Profile found Successfully..!";
		$json['data']=$jsonn;
	if(is_array($json) && count($json)>0)
	{  
		echo json_encode($json);    
			
	}else
	{		
	 	echo json_encode(array('status' => 0, 'msg'=>'data not found..!'));
	}

?>