<?php

require_once "config.php";

header('Content-Type: application/json');

$method = $_SERVER['REQUEST_METHOD'];

switch ($method) {
    case 'GET':
        $cgroup = $_GET["cgroup"];
        $query = $conn->query("SELECT cfoto, cketerangan1, cketerangan2, cketerangan3 FROM tbfotohalutama WHERE cgroup = '$cgroup' order by cfoto desc");
        $result = $query->fetch_all(MYSQLI_ASSOC);
        echo json_encode($result);
        break;
}

mysqli_close($conn);
?>
