I do know db a bit, so here is what I did...
$booking_check_avilability_table = $wpdb->prefix . 'booking_check_avilability';
$fetch_booking_schedule_sql = $wpdb->get_results("select sum(total_room) as total_room from $booking_check_avilability_table where room_type_id = '".$room_type."' and ((check_in_date between '".$_SESSION['side_check_in_date']."' and '".$_SESSION['side_check_out_date']."') or (check_out_date between '".$_SESSION['side_check_in_date']."' and '".$_SESSION['side_check_out_date']."') or (check_in_date <= '".$_SESSION['side_check_in_date']."' and check_out_date >= '".$_SESSION['side_check_in_date']."') or (check_in_date >= '".$_SESSION['side_check_out_date']."' and check_out_date <= '".$_SESSION['side_check_out_date']."'))");
if(count($fetch_booking_schedule_sql) > 0){
foreach($fetch_booking_schedule_sql as $fetch_booking_schedule_res){
$chk_room_cnt = $no_room - $fetch_booking_schedule_res->total_room;
echo '<th>'.$check_in_date.'</th>';
echo '<td>'.$chk_room_cnt.'</td>';
}
}
This is the part which shows the availability for the current day which is working fine.
$one_check_in_date = date('d',strtotime($_SESSION['side_check_in_date']));
$one_check_out_date = date('d',strtotime($_SESSION['side_check_out_date']));
$one_no_rooms = $_SESSION['side_no_rooms'];
$onenext_check_in_date = $one_check_in_date + 1;
$onenext_check_out_date = $one_check_out_date + 1;
$onenext_check_in_date_out = date('Y-m-'.$onenext_check_in_date.'',strtotime($_SESSION['side_check_in_date']));
$onenext_check_out_date_out = date('Y-m-'.$onenext_check_out_date.'',strtotime($_SESSION['side_check_out_date']));
$one_no_room = get_post_meta($room_type,'no_rooms',true);
if($one_no_room == 0){
echo '<th>'.$onenext_check_in_date_out.'</th>';
echo '<td>Not Available</td>';
}
elseif ($one_no_room == $one_no_rooms || $one_no_room > $one_no_rooms) {
$one_fetch_booking_schedule_sql = $wpdb->get_results("select sum(total_room) as total_room from $booking_check_avilability_table where room_type_id = '".$room_type."' and ((check_in_date between '".$onenext_check_in_date_out."' and '".$onenext_check_out_date_out."') or (check_out_date between '".$onenext_check_in_date_out."' and '".$onenext_check_out_date_out."') or (check_in_date <= '".$onenext_check_in_date_out."' and check_out_date >= '".$onenext_check_in_date_out."') or (check_in_date >= '".$onenext_check_out_date_out."' and check_out_date <= '".$onenext_check_out_date_out."'))");
if(count($one_fetch_booking_schedule_sql) > 0){
foreach($one_fetch_booking_schedule_sql as $one_fetch_booking_schedule_res){
$one_chk_room_cnt = $one_no_room - $fetch_booking_schedule_res->total_room;
echo '<th>'.$onenext_check_in_date_out.'</th>';
echo '<td>'.$one_chk_room_cnt.'</td>';
}
}
}
This shows of the next day which isn't working, it always shows 0 !