<?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 "Checking arsip table structure:\n";
    $stmt = $sipp_db->query('DESCRIBE arsip');
    $columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
    foreach($columns as $col) {
        echo $col['Field'] . " (" . $col['Type'] . ")\n";
    }
    
    echo "\nSample data from arsip table:\n";
    $stmt = $sipp_db->query('SELECT * FROM arsip LIMIT 3');
    $sample = $stmt->fetchAll(PDO::FETCH_ASSOC);
    foreach($sample as $i => $row) {
        echo "Row " . ($i+1) . ":\n";
        foreach($row as $key => $value) {
            echo "  $key: " . (is_null($value) ? 'NULL' : $value) . "\n";
        }
        echo "\n";
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
?>
