<?php
include '_db.php';

// session_start();

if (isset($_GET['delete'])) {
    $delete_id = $_GET['delete'];
    
    // Use prepared statement to delete record
    $delete_query = $conn->prepare("DELETE FROM profit_additions WHERE id = ?");
    $delete_query->bind_param("i", $delete_id); // Bind the parameter
    $delete_query->execute(); // Execute the statement

    if ($delete_query) {
        header('location: running_investment.php');
        $_SESSION['message'] = 'Product has been deleted';
    } else {
        header('location: running_investment.php');
        $_SESSION['message'] = 'Product could not be deleted';
    }
}
?>
