<?php 
@session_start();
$db='laabh';
$conn = mysql_connect('localhost', 'akhilagya', 'abhinay@2018AB') or die ("connection not found");
	mysql_select_db($db) or die ("connection not found");
if($_REQUEST["type"]=='sup'){
$supplier_id=$_REQUEST["supplier_id"];


$sqlitm="select * from tbl_supplier where id = '$supplier_id' and session_login_id = '".$_SESSION['login_id']."'";
							//echo $sqlc;
							$citm=mysql_query($sqlitm);
							if(mysql_num_rows($citm)>0){
						$row_itm=mysql_fetch_array($citm);

$gstnum = $row_itm['gstin'];
$state_code =  substr($gstnum, 0, 2);
			 $array[] = $state_code;
			 
			
		}
		}
		
		
		if($_REQUEST["type"]=='cln'){
$client_id=$_REQUEST["client_id"];


$sqlitm="select * from tbl_client where id = '$client_id' and session_login_id = '".$_SESSION['login_id']."'";
							//echo $sqlc;
							$citm=mysql_query($sqlitm);
							
						$row_itm=mysql_fetch_array($citm);

$gstnum = $row_itm['tin_no'];

$state_code =  substr($gstnum, 0, 2);
			 
			if($state_code==''){
			$state_code =$_SESSION['state_code'];
			}
			$array[] = $state_code;
		
		}
		
		 echo json_encode($array);
?>

                  
               
 