<?php

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

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
 if (isset($_REQUEST['passport'])) {
$passport = $_REQUEST['passport'];

//$qry = mysqli_query($conn, "SELECT  a.passrecd,a.mofa_date,a.stampdate,b.vouchdt,b.fitdate FROM `visatran` a left join  `medent` b on a.`passport` = '$passport'  WHERE a.passport = b.passport ") or die(mysqli_error($conn));
$qry = mysqli_query($conn, "SELECT  vouchdt,fitdate FROM `medent` WHERE passport = '$passport'") or die(mysqli_error($conn));
//$qry = mysqli_query($conn, "SELECT  *,date_format(`passrecd`,'%d-%m-%Y') as passrecd FROM `visatran` where `passport` = '$passport'") or die(mysqli_error($conn));
$mname = mysqli_fetch_array($qry);
$ctr2 = 0;
//$pctr2 = 1;
$success = true;
     
         $rows = array('success' => $success,
            'passrecd' => $mname['passrecd'],
            'meddate' => $mname['vouchdt'],
            'fitdate' => $mname['fitdate'],
            'mofa_date' => $mname['mofa_date'],
            'stampdate' => $mname['stampdate'],
            
        );

$ctr2++;

header("Content-type: application/json");
echo json_encode($rows);
 }
?>