<?php
require_once 'config/database.php';

try {
    // Test the query that's used in the fees page
    echo "Testing query from fees page...\n";
    $stmt = $pdo->query("SELECT * FROM bank_accounts ORDER BY bank_name, branch_name");
    $results = $stmt->fetchAll();
    echo "Query executed successfully. Found " . count($results) . " records.\n";
    
    // Show first record if available
    if (!empty($results)) {
        echo "\nFirst record sample:\n";
        $first = $results[0];
        echo "- bank_name: " . ($first['bank_name'] ?? 'undefined') . "\n";
        echo "- branch_name: " . ($first['branch_name'] ?? 'undefined') . "\n";
        echo "- account_number: " . ($first['account_number'] ?? 'undefined') . "\n";
        echo "- account_name: " . ($first['account_name'] ?? 'undefined') . "\n";
    }
    
    echo "\nTest completed successfully!\n";
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
?>