DIDS-Coursework/DIS-COMP4039-CW2-psxrp11-20450011/psxrp11-20450011_InstallationFiles/getReports.php

18 lines
666 B
PHP
Raw Normal View History

<?php
session_start();
require_once 'config.php';
header('Content-Type: application/json');
if (isset($_SESSION["username"]))
{
$conn = dbConn();
$stmt = $conn->prepare("SELECT Vehicle_type, People_name, Incident_Date, Incident_Report, Offence_description FROM Incident INNER JOIN People P on Incident.People_ID = P.People_ID INNER JOIN Vehicle V on Incident.Vehicle_ID = V.Vehicle_ID INNER JOIN Offence O on Incident.Offence_ID = O.Offence_ID;");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(array("message" => "ok", "data" => $result));
}
else
{
echo json_encode(array("message" => "Not logged in "));
}