prepare("UPDATE products SET deleted_at = NOW() WHERE id = ?"); $stmt->execute([$id]); // Log action $log_stmt = db()->prepare("INSERT INTO audit_logs (user_id, action, entity_type, entity_id, details) VALUES (?, ?, ?, ?, ?)"); $log_stmt->execute([$_SESSION['user_id'], 'DELETE', 'PRODUCT', $id, "Soft deleted"]); } $_SESSION['success'] = "Product deleted successfully."; header("Location: products.php"); exit;