<?php
	
	require "../commonincludefiles.php";
	
	$employee_id = Escape($_POST['employee_id']);
	    
	$qry = "select distinct asm.assign_id,asm.employee_id,asm.subject_id,branch_id,semester_id from assign_subject_master asm, cms_subjectmaster sub
	        where asm.subject_id = sub.subject_id";
	if($employee_id != "")		
	  {
		  $qry .= " AND employee_id = '$employee_id'";
	  }
	$rs = dbQuery($qry);
	$i=0;
	$total = dbRows($rs);
	$SubjectData = array("count" => $total, "data" => array());
	if(dbRows($rs) > 0){
		while($row = dbArray($rs)){
					$temparray["assign_id"] = $row["assign_id"];
					$temparray["branch_id"] = $row["branch_id"];
					$temparray["semester_id"] = $row["semester_id"];
					$temparray["employee_id"] = $row["employee_id"];								
					$temparray["subject_id"] = $row["subject_id"];													
					$SubjectData["data"][$i] = $temparray;   
					$i++;	
	}
	}
	echo json_encode($SubjectData);
	
	
?>