<?php
			include('session.php');
			include('connection.php');
			
			$dept = $_GET['q'];
 			if($dept != '')
 			{
 							$sub_dept_code = "";
 							$dept_sub_category = "";
 							$val = "";
 							if($dept == '101')
 							{
 										$sql = "SELECT * FROM `main_sub_dept_cat1` where sub_dept_code in (1,2,4,5)";	
 							}
 							else if($dept == '201')
 							{
 										$sql = "SELECT * FROM `main_sub_dept_cat1` where sub_dept_code in (1,2,5,7)";	
 							}
 							else if($dept == '301')
 							{
 										$sql = "SELECT * FROM `main_sub_dept_cat1` where sub_dept_code in (1,2,5,7,8)";	
 							}
 							else 
 							{
 										$sql = "SELECT * FROM `main_sub_dept_cat1` where sub_dept_code in (1,2,5,7)";	
 							}
 							$result = mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");	
 							$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql) or die("Error in fetch Sub dept!!");
 							$users_arr = array();
 							while($rw = mysqli_fetch_assoc($result))
 							{
 										$sub_dept_code = $rw['sub_dept_code'];
 										$dept_sub_category = $rw['dept_sub_category'];
 										//$users_arr[] = array("id" => $sub_dept_code, "name" => $dept_sub_category);
 										$users_arr[] = 	$sub_dept_code.",".$dept_sub_category;
 							}
 							$val = implode('#',$users_arr);
 							echo $val;
 							//echo json_encode($users_arr,JSON_UNESCAPED_UNICODE);
 							//die;
 			}
?>