<?php
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
    echo "Access Denied";
    exit();
}

include 'config.php';

$sql = "SELECT * FROM `match`";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    $rows = array();
    while($row = $result->fetch_assoc()) {
        $rows[] = $row;
    }
    if ('reverse' === 'reverse') {
        $rows = array_reverse($rows);
    }
    header('Content-Type: application/json');
    echo json_encode($rows);
} else {
    echo "No Data Found";
}

$conn->close();
?>