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

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
$admin = $_SESSION["admin_" . $dbname];
$success = false;


if (isset($_REQUEST["eventdt"])) {
    $eventdt = $_REQUEST['eventdt'];
    $hall = $_REQUEST['hall'];
    $vouchno = $_REQUEST['vouchno'];
        
    $query2 = "SELECT vouchno,hall,DATE_FORMAT(`eventdt`, '%d-%m-%Y')as eventdt FROM `hallbook` WHERE hall ='$hall' and eventdt  = '$eventdt' 
                      and vouchno != '$vouchno' " ;
        
    $result2 = mysqli_query($conn, $query2)or die(mysqli_error($conn));
    $r = mysqli_fetch_assoc($result2);
    
    $rows = array();
    $ctr = 0;
    $rows = array('success' => true,
   
        'vouchno'         => "$r[vouchno]",
        'eventdt'         => "$r[eventdt]",
        'memname'       => "$r[name]");
    header("Content-type: application\json");
    echo json_encode($rows);
}
