<?php
session_start();
include "conexion.php";

if (!isset($_SESSION['usuario'])) {
    header("Location: index.php");
    exit();
}

$idreginv = $_GET['id'];
$idinv = $_GET['idinv'];

// Eliminar la inversión
$sql = "DELETE FROM inversion WHERE idreginv = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $idreginv);
$stmt->execute();

header("Location: detalle.php?id=$idinv");
exit();
?>