='$date' order by id asc "); while($get = mysqli_fetch_array($get_available_dates, MYSQLI_ASSOC)){ $title = $get['from_hour'].':'.$get['from_min'].' '.strtoupper($get['from_sta']).' to '.$get['to_hour'].':'.$get['to_min'].' '.strtoupper($get['to_sta']); $new_time = $get['to_hour'].':'.$get['to_min'].' '.strtoupper($get['to_sta']); $set_date = $get['date'].' '.$new_time; $date1 = date('Y-m-d H:i:s', strtotime($set_date)); // $dates = $date1->format('Y-m-d H:i:s'); $get_appt = get_appt($get['date'], $conn); if(date('Y-m-d') == $get['date'] && date('Y-m-d H:i:s') > $date1) { $data[] = array('title' => ' ', 'start'=>$get['date'], 'backgroundColor' => 'red', 'borderColor'=>'red', 'holiday'=>1, 'url' =>''); } elseif($get_appt == 0) { $data[] = array('title' => ' ', 'start'=>$get['date'], 'backgroundColor' => 'red', 'borderColor'=>'red', 'holiday'=>1, 'url' =>''); }elseif($get_appt == 1) { $data[] = array('title' => 'Book', 'start'=>$get['date'], 'backgroundColor' => 'orange', 'borderColor'=>'orange', 'holiday'=>2, 'url' => 'appointment.php?id='.strtotime($get['date'])); }elseif($get_appt > 1){ $data[] = array('title' => 'Book','start'=>$get['date'], 'backgroundColor' => '#00cc00', 'borderColor'=>'#00cc00', 'holiday'=>3,'url' => 'appointment.php?id='.strtotime($get['date'])); } //$data[] = array('title' => 'Booking Open','start'=>$get['dates1'], 'end' => $get['dates1']); } echo json_encode($data); ?>