ESH/get_availabe_slots.php
2024-10-23 18:28:06 +05:30

24 lines
768 B
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
include_once('log_entry.php');
$slot=$_REQUEST['slot'];
$date = $_REQUEST['appointment_book_date'];
$sql = "SELECT count(*) as booked from appointment_details where date(date)=str_to_date('".$date."','%Y-%m-%d') and ohc_type_id='".$_SESSION['current_ohcttype']."' and time ='".$slot."' ";
error_log($sql."select_slot");
if (!$result = @mysqli_query($conn,$sql)) {
exit(mysqli_error($conn));
}
$data = array();
while ($row = mysqli_fetch_assoc($result)) {
$data['slot_available']=getTableFieldValue('appoinment_slots','slot_count','slot_id',$slot)-$row['booked'];
}
$data['count']=mysqli_num_rows($result);
error_log('data '.print_r($data,true));
echo json_encode($data);
?>