Files
edu/bbs/myclass/_back/_tmp_goal_rows_check.php
T

45 lines
1.7 KiB
PHP

<?php
require_once __DIR__ . '/db_conn.php';
header('Content-Type: text/plain; charset=utf-8');
$year = date('Y');
$pdo = db_conn();
$sql = "SELECT content_id, goal_code, title, description, description1, description2, sort_order, base_year, category_code, category_group, updated_at
FROM edu_contents
WHERE is_active = '1'
AND category_code = 'CA10001'
AND category_group = 'CA200Q01'
AND sort_order = 1
AND base_year = ?
ORDER BY goal_code ASC";
$st = $pdo->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";
}