$row['id'], 'title' => $title, 'start' => $start, 'end' => $end, 'allDay' => $full_day, 'backgroundColor' => $color ); array_push($eventArray, $array); } /* TIMBRATURE */ $sqlQuery = "SELECT * FROM stamps WHERE user_id = $user_id ORDER BY date"; $result = mysqli_query($con, $sqlQuery); while ($row = mysqli_fetch_assoc($result)) { $start = $row['date'] . "T" . $row['time']; if ($row["delete_request"] == 1 && $row["delete_request_rejected"] == 0) { $title = $row['type'] . " (Richiesta eliminazione)"; } else { $title = $row['type']; } if ($row['type'] == "Entrata") { $color = '#2196f3'; } else { $color = '#009688'; } $array = array( 'id' => $row['id'], 'title' => $title, 'start' => $start, 'allDay' => false, 'backgroundColor' => $color ); array_push($eventArray, $array); } /* TRASFERTE */ $sqlQuery = "SELECT * FROM transfers WHERE user_id = $user_id AND status_id = 2"; $result = mysqli_query($con, $sqlQuery); while ($row = mysqli_fetch_assoc($result)) { $start = $row['start_date'] . "T00:00:00"; $ending_date = date('Y-m-d', strtotime('+1 day', strtotime($row['end_date']))); $end = $ending_date . "T00:00:00"; $color = '#f44336'; $title = 'Trasferta: ' . $row['destination']; $array = array( 'id' => $row['id'], 'title' => $title, 'start' => $start, 'end' => $end, 'allDay' => true, 'backgroundColor' => $color ); array_push($eventArray, $array); } mysqli_free_result($result); mysqli_close($con); echo json_encode($eventArray);