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