<?php
require 'db.php';

try {
    $count = $db->query('SELECT COUNT(*) FROM peminjaman')->fetchColumn();
    echo "Records in peminjaman table: $count\n";
    
    if ($count > 0) {
        echo "\nSample records:\n";
        $rows = $db->query('SELECT id, nomor_perkara, nama, status FROM peminjaman LIMIT 5')->fetchAll();
        foreach ($rows as $row) {
            echo "ID: {$row['id']}, Nomor: {$row['nomor_perkara']}, Nama: {$row['nama']}, Status: {$row['status']}\n";
        }
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
?>
