<?php
session_start();
$nombre = @$_POST['nombre'];
$email = @$_POST['email'];
$fecha = @$_POST['fecha'];
$numero = @$_POST['numero'];
$tipo = @$_POST['tipo'];
$name = $_SESSION['nombre'];
$id = $_SESSION['id'];

$servername = "localhost";
$username = "itladevprubycom_enma";
$password = "53gNpj4t.xDc";
$database = "itladevprubycom_enma1";

// Crear conexi贸n
$conexion = new mysqli($servername, $username, $password, $database);

// Verificar conexi贸n
if ($conexion->connect_error) {
    die("Error de conexion: " . $conexion->connect_error);
}
if(!empty($_GET["id"])){
    $id = $_GET["id"];
}

$query = "SELECT * FROM historial WHERE id = '$id'";
$todo = $conexion->query($query);

    while ($total = $todo->fetch_assoc()) {
        $name = $total["nombre"];
    }

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Editar Registro</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.18.1/dist/css/uikit.min.css" />
    <script src="https://cdn.jsdelivr.net/npm/uikit@3.18.1/dist/js/uikit.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/uikit@3.18.1/dist/js/uikit-icons.min.js"></script>
</head>
<body>
    <?php include "include/navbar.php";?>
    <div class="uk-container uk-margin-top uk-margin-bottom">
        <div class="uk-card uk-card-body">
            <h3 class="uk-card-title uk-text-center">Historial:</h3>
            <div class="uk-grid uk-child-width-1-1@s uk-child-width-1-2@m uk-child-width-1-3@l uk-margin-large-top" uk-grid>
                <?php foreach($name as $row): ?>
                    <div>
                        <div class="uk-card uk-card-default uk-card-body">
                            <h4 class="uk-card-title"><?php echo $row["usuario"]; ?></h4>
                            <p><?php echo $row["Producto"]; ?></p>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
    <div class="uk-container uk-flex uk-flex-center uk-margin-small-top">
        <a href="index.php" class="uk-button uk-button-default">Volver al inicio</a>
    </div>
</body>
</html>
