DIDS-Coursework/DIS-COMP4039-CW2-psxrp11-20450011/psxrp11-20450011_InstallationFiles/getReports.php
rodude123 8cd1f3cfda Final commit of the coursework with the pdfs
Signed-off-by: rodude123 <rodude123@gmail.com>
2022-12-18 16:28:10 +00:00

18 lines
666 B
PHP

<?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 "));
}