<?php include('lib/config.php');?>
<?php 
$deptID = isset($_POST['did'])?$_POST['did']:'';

if(!empty($deptID))
{							  
	$srno = 0;
    $output = [];
	$selQry_files = "SELECT * FROM ".TBL_FILES." WHERE department_id = '".$deptID."' ORDER BY name";
	$filesInfo =  $con->getMultiRow($selQry_files, __FILE__,__LINE__);
	$totFilesListings = count($filesInfo);
	if($totFilesListings>0)
	{
		for($file=0;$file<$totFilesListings;$file++)
		{
			$srno++;
			
			$output[] = array(
                            'file_id' => $filesInfo[$file]['id'],
                            'file_name' => $filesInfo[$file]['name']
                        );
		}
		
		echo json_encode($output);
	}
}
?>