TKK_E32230273/test_db_dump.php

22 lines
591 B
PHP

<?php
include 'koneksi.php';
$output = [];
try {
$stmt = $pdo->query('SELECT id_occupant, name, pin, foto FROM occupant LIMIT 10');
$output['occupants'] = $stmt->fetchAll();
$manifestPath = __DIR__ . '/manifest_pin_tokens.json';
if (file_exists($manifestPath)) {
$output['tokens'] = json_decode(file_get_contents($manifestPath), true);
} else {
$output['tokens'] = 'File not found';
}
} catch (Exception $e) {
$output['error'] = $e->getMessage();
}
header('Content-Type: application/json');
echo json_encode($output, JSON_PRETTY_PRINT);
?>