<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$array    = '';
$zdb = $_SESSION["zdbyear_".$dbname];
mysqli_select_db($conn,$zdb);

if(isset($_REQUEST['mobile'])){
   $mmobile = $_REQUEST['mobile'];
   $mname = $_REQUEST['name'];
   $mvouchno = $_REQUEST['vouchno'];
//   print "SELECT a.*, b.discount FROM `item` a, `itemgrp` b WHERE a.barcode = '$barcoden' and a.group = b.code " ;
//   $iresult = mysqli_query($conn,"SELECT `mobile`, `name`, `vouchno` FROM `visamain` WHERE mobile ='$mmobile' order  by vouchno desc limit 0,1") or die(mysqli_error($conn));
   $iresult = mysqli_query($conn,"SELECT `mobile`, `name`, `vouchno` FROM `visamain` WHERE mobile ='$mmobile' or name='$mname' or vouchno='$vouchno' ") or die(mysqli_error($conn));
   
   if(mysqli_num_rows($iresult) > 0){
      $array    = mysqli_fetch_array($iresult);
      
      $mobile      = $array["mobile"];
      $name         = $array["name"];
      $vouchno     = $array["vouchno"];
      
    } 
    
    header("Content-type: application\json");
    $data=array("mobile"=>$mobile,"name"=>$name,"vouchno"=>$vouchno);
    echo json_encode($data);
}

?>