DIDS-Coursework/DIS-COMP4039-CW2-psxrp11-20450011/psxrp11-20450011_InstallationFiles/getOffences.php
rodude123 108cf7586d Added in the ability to create new reports
Signed-off-by: rodude123 <rodude123@gmail.com>
2022-12-16 13:21:10 +00:00

17 lines
463 B
PHP

<?php
session_start();
require_once 'config.php';
header('Content-Type: application/json');
if (isset($_SESSION["username"]))
{
$conn = dbConn();
$stmt = $conn->prepare("SELECT Offence_ID, Offence_description, Offence_maxFine FROM Offence");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(array("message" => "ok", "offences" => $result));
}
else
{
echo json_encode(array("message" => "Not logged in "));
}