34849-vm/delete_column.php
2026-02-03 01:43:03 +00:00

22 lines
597 B
PHP

<?php
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = $_POST['id'];
if (!empty($id)) {
$pdo = db();
// First, update info_productos to set column_id to NULL for the cards in the deleted column
$stmt_update = $pdo->prepare('UPDATE info_productos SET column_id = NULL WHERE column_id = ?');
$stmt_update->execute([$id]);
// Then, delete the column
$stmt_delete = $pdo->prepare('DELETE FROM kanban_columns WHERE id = ?');
$stmt_delete->execute([$id]);
}
}
header('Location: kanban.php');
exit;