I have this function:
public function get_free_courtrooms() {
$post = file_get_contents('php://input');
$_POST = json_decode($post, true);
$date = $this->input->post('date', true);
$time_start = $this->input->post('time_start', true);
$time_end = $this->input->post('time_end', true);
$where = array('date' => $date);
$reservations = $this->MY_Model->get('reservations', $where);
$courtrooms = $this->MY_Model->get('courtrooms');
$output = array(
'free_courtrooms' => $free_courtrooms
);
echo json_encode($output);
exit();
}
I need to remove all courtrooms from $courtrooms that are booked in sending hours ($time_start, $time_end).
In reservations table I have:
- id
- courtroom_id
- date
- time_start
- time_end
$time_start,$time_end.