<?php
session_start();
header('Content-Type: application/json');
include '../config/database.php';
$db = new Database();
$conn = $db->getConnection();

$stmt = $conn->prepare("SELECT u.*, g.nama_gereja FROM users u 
                        LEFT JOIN gereja g ON u.gereja_id=g.id 
                        ORDER BY u.id DESC");
$stmt->execute();
echo json_encode(['data'=>$stmt->fetchAll(PDO::FETCH_ASSOC)]);
?>