prepare($sql); $st->execute([$year]); $rows = $st->fetchAll(PDO::FETCH_ASSOC); echo "[CURRENT QUERY ROWS] count=" . count($rows) . "\n"; foreach ($rows as $r) { echo ($r['goal_code'] ?? '') . " | title=" . ($r['title'] ?? '') . " | description=" . ($r['description'] ?? '') . " | description1=" . ($r['description1'] ?? '') . " | description2=" . ($r['description2'] ?? '') . " | content_id=" . ($r['content_id'] ?? '') . "\n"; } echo "\n[ALL GOAL ROWS SAMPLE]\n"; $rows2 = $pdo->query("SELECT goal_code, sort_order, title, description, description1, description2, content_id FROM edu_contents WHERE is_active='1' AND category_code='CA10001' AND category_group='CA200Q01' ORDER BY goal_code ASC, sort_order ASC, content_id ASC LIMIT 40")->fetchAll(PDO::FETCH_ASSOC); foreach ($rows2 as $r) { echo ($r['goal_code'] ?? '') . "#" . ($r['sort_order'] ?? '') . " | t=" . ($r['title'] ?? '') . " | d=" . ($r['description'] ?? '') . " | d1=" . ($r['description1'] ?? '') . " | d2=" . ($r['description2'] ?? '') . " | id=" . ($r['content_id'] ?? '') . "\n"; }