prepare("SELECT imagen FROM blog_posts WHERE id = ?"); $stmt->execute([$_GET['id']]); $post = $stmt->fetch(); if ($post && $post['imagen']) { $ruta_imagen = '../' . $post['imagen']; if (file_exists($ruta_imagen)) { unlink($ruta_imagen); } } // Eliminar el artículo $stmt = $pdo->prepare("DELETE FROM blog_posts WHERE id = ?"); $stmt->execute([$_GET['id']]); header('Location: dashboard.php'); exit; ?>