<?php 
ob_start();
session_start();
include "../inc/config.php";
$today_date = date('Y-m-d');

 if($_POST['type']=="get_branches"){
       
       
    $branch_id = $_POST['branch_id'];
$condition ='';

if($branch_id!='all')
{
   $condition.="and branch_id='".$branch_id."'";
   
}



         error_log("SELECT * FROM `tbl_user` WHERE 1=1 $condition ");
    
        $statement = $pdo->prepare("SELECT * FROM `tbl_user` WHERE 1=1 $condition ");
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalrow = $statement->rowCount();
		
		if($result){
		    
		    
		    $response['data']=$result;
		    $response['error']=false;
		    $response['message']="Client Details Fetched Successfully";
		}else{
		    $response['count']=0;
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}        

?>