<?php
try {
    $sipp_config = [
        'host' => '192.168.1.240',
        'dbname' => 'sippbaco',
        'username' => 'pnwtp',
        'password' => 'pnwtp2019',
        'port' => 3306
    ];
    $dsn = "mysql:host={$sipp_config['host']};port={$sipp_config['port']};dbname={$sipp_config['dbname']};charset=utf8mb4";
    $sipp_db = new PDO($dsn, $sipp_config['username'], $sipp_config['password']);
    $sipp_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    echo "Testing column mapping (first 3 rows):\n";
    echo "=====================================\n";
    $stmt = $sipp_db->query('SELECT id, nomor_arsip, no_ruang, no_lemari, no_rak, no_berkas, nomor_perkara, tanggal_masuk_arsip FROM arsip LIMIT 3');
    $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    foreach($rows as $i => $row) {
        echo "Row " . ($i+1) . ":\n";
        echo "  Nomor Arsip: " . ($row['nomor_arsip'] ?? 'NULL') . "\n";
        echo "  Nomor Ruang: " . ($row['no_ruang'] ?? 'NULL') . "\n";
        echo "  Nomor Lemari: " . ($row['no_lemari'] ?? 'NULL') . "\n";
        echo "  Nomor Rak: " . ($row['no_rak'] ?? 'NULL') . "\n";
        echo "  Nomor Berkas: " . ($row['no_berkas'] ?? 'NULL') . "\n";
        echo "  Nomor Perkara: " . ($row['nomor_perkara'] ?? 'NULL') . "\n";
        echo "  Tanggal Masuk: " . ($row['tanggal_masuk_arsip'] ?? 'NULL') . "\n";
        echo "\n";
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
?>
