ok
Direktori : /home2/selectio/public_html/thedentalpark.com/admin/apis/ |
Current File : /home2/selectio/public_html/thedentalpark.com/admin/apis/time_slot.php |
<?php require_once '../config/config.php'; $date = $_GET['date'] ?? ''; $times = $_GET['time'] ?? ''; if (!$date) { echo "<option value=''>No date provided</option>"; exit; } $statement = $pdo->prepare("SELECT time FROM `tbl_appointment_booking` WHERE date = :date"); $statement->bindParam(':date', $date, PDO::PARAM_STR); $statement->execute(); $customers = $statement->fetchAll(PDO::FETCH_ASSOC); $all_time_slots = ['09:30 AM','10:30 AM','11:30 AM','12:30 PM','01:30 PM','05:30 PM','06:30 PM','07:30 PM','08:30 PM']; $booked_times = []; foreach ($customers as $customer) { $booked_times[] = $customer['time']; } $available_times = array_diff($all_time_slots, $booked_times); if($times!="" && $times!=null){ $available_times[] = $times; } if (!empty($available_times)) { foreach ($available_times as $time) { echo "<option value=\"$time\" ".($times==$time?'selected': '').">$time</option>"; } } else { echo "<option value=\"\">No Available Slots</option>"; } ?>