<!-- <?php
include 'db.php';


$roleId = $_POST['role_id'];
$rights = $_POST['rights']; // array of right IDs

// First delete existing rights
$conn->query("DELETE FROM role_rights WHERE role_id = $roleId");

foreach ($rights as $rightId) {
    $stmt = $conn->prepare("INSERT INTO role_rights (role_id, right_id) VALUES (?, ?)");
    $stmt->bind_param("ii", $roleId, $rightId);
    $stmt->execute();
}
echo "Rights assigned successfully!";
?> -->
