<?php
// Test script to verify the FIXED query in Bitacora.php
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once "../config/Conexion.php";
require_once "../modelos/Bitacora.php";

$bitacora = new Bitacora();
$idpersona = 9; // Use a known ID typical of testing

echo "Testing listarHistorial with idpersona = $idpersona...<br>";

try {
    $rspta = $bitacora->listarHistorial($idpersona);

    if (!$rspta) {
        echo "Error: Query returned false. " . $conexion->error;
    } else {
        echo "Success! Rows found: " . $rspta->num_rows . "<br>";
        while ($reg = $rspta->fetch_object()) {
            echo "Row: " . print_r($reg, true) . "<br>";
        }
    }

} catch (Exception $e) {
    echo "Exception: " . $e->getMessage();
}
?>