getConnection(); $stmt = $pdo->prepare("SELECT * FROM excel_templates WHERE id = ?"); $stmt->execute([$id]); $template = $stmt->fetch(PDO::FETCH_ASSOC); if (!$template) { header("Location: template_dashboard.php?status=error&message=" . urlencode("Template not found")); exit; } // Debug del template error_log("Loaded template: " . print_r($template, true)); ?>