<?php
require_once 'includes/db.php';

echo "<h1>Lista de Usuarios para Pruebas</h1>";
try {
    $stmt = $pdo->query("SELECT u.id, u.username, u.email, r.name as role_name FROM users u JOIN roles r ON u.role_id = r.id");
    echo "<table border='1'><tr><th>ID</th><th>Username</th><th>Email</th><th>Rol</th></tr>";
    while ($row = $stmt->fetch()) {
        echo "<tr><td>{$row['id']}</td><td>{$row['username']}</td><td>{$row['email']}</td><td>{$row['role_name']}</td></tr>";
    }
    echo "</table>";
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}
?>
