<?php
include "db.php";

if (!isset($_GET['id']) || !isset($_GET['pid'])) {
    die("Parâmetros inválidos.");
}
$id = (int) $_GET['id'];
$pid = (int) $_GET['pid'];

$stmt = $pdo->prepare("DELETE FROM pesquisa_campos WHERE id = :id");
$stmt->execute(['id' => $id]);

header("Location: pesquisa_edit.php?id=$pid");
exit;
