<?php

include 'load.php';
$datearr = array();
if(isset($_POST['room'])){
    $room = $_POST['room'];
    
    $roombooking = mysqli_query($conn, "SELECT * FROM mobileroombooking WHERE room='$room'");

    if ($roombooking->num_rows > 0) {
        while($row = $roombooking->fetch_assoc()) {
           $start =  new DateTime($row['checkindate']);
           $end =  new DateTime($row['checkoutdate']);

           $end->modify('+1 day');

           $interval = new DateInterval('P1D');
           
           $datePeriod = new DatePeriod($start, $interval, $end);
       
           foreach ($datePeriod as $date) {
              
               array_push($datearr,$date->format('Y-m-d') . PHP_EOL);
           }
           
        }
    }


}

echo json_encode($datearr);






?>