='$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']) { $data[] = array('title' => ' ', 'start'=>$get['date'], 'backgroundColor' => 'red', 'borderColor'=>'red', 'holiday'=>1, 'url' =>''); }elseif(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' => 'customer_appointment_form.php?app_id='.$get['id']); }elseif($get_appt > 1){ $data[] = array('title' => 'Book','start'=>$get['date'], 'backgroundColor' => '#00cc00', 'borderColor'=>'#00cc00', 'holiday'=>3,'url' => 'customer_appointment_form.php?app_id='.$get['id']); } //$data[] = array('title' => 'Booking Open','start'=>$get['dates1'], 'end' => $get['dates1']); } $column = array_column($data, 'start'); // // Get the array with unique values based on the 'id' column $uniqueArray = array_intersect_key($data, array_unique($column)); $items = []; foreach ($uniqueArray as $val){ $items[] = $val; } echo json_encode($items); ?>