prepare("SELECT * FROM Incident"); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); echo json_encode(array("message" => "ok", "incidents" => $result)); } else if (isset($_SESSION["username"]) && !isset($_SESSION["admin"])) { echo json_encode(array("message" => "not logged in as admin")); } else { echo json_encode(array("message" => "Not logged in ")); }