<?php
require_once "../config/Conexion.php";
echo "<h1>Diagnostic: Last 10 Entries in bitacora_evolucion</h1>";
$sql = "SELECT * FROM bitacora_evolucion ORDER BY idbitacora DESC LIMIT 10";
$res = $conexion->query($sql);
if ($res) {
    echo "<table border='1'><tr><th>ID</th><th>ATENCION</th><th>PERSONA</th><th>USUARIO</th><th>FECHA</th><th>NOTA</th></tr>";
    while ($row = $res->fetch_assoc()) {
        echo "<tr>";
        echo "<td>" . $row['idbitacora'] . "</td>";
        echo "<td>" . $row['idatencion'] . "</td>";
        echo "<td>" . $row['idpersona'] . "</td>";
        echo "<td>" . $row['idusuario'] . "</td>";
        echo "<td>" . $row['fecha_evolucion'] . "</td>";
        echo "<td>" . $row['nota'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";
} else {
    echo "Error querying table: " . $conexion->error;
}
?>