<?php  

  session_start();
   include("../db.php");
  include("../all_query.php");
  
  
    $location = 'mumbai';
	
	if(isset($_REQUEST['location']))
	{
		$location = $_REQUEST['location'];
	}
  
  
$callInitQ = mysqli_query($conn,"select *from  `call_init`    where  is_hit = '0' and  customer_type='$location' limit 5 "); 
	  
// $callInitQ = mysqli_query($conn,"select *from  `call_init` where is_hit = '0' limit 5 ");
 
 
	 $result = array();
	 
	 while($callInitData = mysqli_fetch_assoc($callInitQ))
	 {
		 
		 $id = $callInitData['id'];
		 
		 
		 $result[] = $callInitData;
		 
		 
		 mysqli_query($conn," update `call_init` set is_hit = '1' where id = $id ");
		 
	 }
	 
	 echo json_encode($result);
		
		
 ?>