<?php
require_once __DIR__ . '/db/config.php';

if (isset($_GET['id'])) {
    $id = $_GET['id'];

    try {
        $pdo = db();
        $stmt = $pdo->prepare("DELETE FROM bni_groups WHERE id = :id");
        $stmt->bindParam(':id', $id, PDO::PARAM_INT);
        $stmt->execute();

        $_SESSION['success_message'] = 'BNI Group deleted successfully!';
    } catch (PDOException $e) {
        $_SESSION['error_message'] = 'Error deleting BNI group: ' . $e->getMessage();
    }
}

header('Location: bni_groups.php');
exit;
