<?php
echo "Attempting to include config.php...<br>";
require_once 'config.php';
echo "config.php included successfully.<br><br>";

if (isset($pdo)) {
    echo "PDO object exists. Trying to query the database...<br>";
    try {
        $stmt = $pdo->query("SELECT 1");
        if ($stmt) {
            echo "<h2 style='color:green;'>SUCCESS: Database connection is working correctly!</h2>";
        }
    } catch (PDOException $e) {
        echo "<h2 style='color:red;'>DATABASE ERROR: " . $e->getMessage() . "</h2>";
    }
} else {
    echo "<h2 style='color:red;'>FAILURE: The \$pdo database connection object was not created in config.php.</h2>";
}