getConnection(); $template_id = $_GET['template_id'] ?? 0; try { $stmt = $pdo->prepare("SELECT id, field_id, excel_column, is_manual, manual_default, field_label FROM template_mapping WHERE template_id = ?"); $stmt->execute([$template_id]); $mappings = $stmt->fetchAll(PDO::FETCH_ASSOC); echo json_encode(["success" => true, "mappings" => $mappings]); } catch (Exception $e) { echo json_encode(["success" => false, "message" => "Error: " . $e->getMessage()]); } exit;