<?php
	require "../commonincludefiles.php";
 	$arr = array();
 	$total = 0;
	
	if($_REQUEST['branch_name']!="" && $_REQUEST['semester_name']!=""){
		
		$sql = "SELECT * FROM cms_subjectmaster WHERE subject_active='1' and 
				branch_id = '".Escape($_REQUEST['branch_name'])."' AND 
				semester_id = '".Escape($_REQUEST['semester_name'])."' ";
		$rs = dbQuery($sql);		
		$total=dbRows($rs);
		$i = 0;
		$SubjectData = array("count" => $total, "data" => array());
		if(dbRows($rs) > 0){
			while($row = dbArray($rs)){
				$temparray["subject_id"]  	= $row["subject_id"];
				$temparray["subject_name"]	= $row["subject_name"]." ( Sub Code : ".$row["subject_code"]." )";
				$SubjectData["data"][$i] 	= $temparray;   
				$i++;
			}
		}
	}
	
	echo json_encode($SubjectData);	
?>