Initial commit: 교육 프로젝트 배포
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/db_conn.php';
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
|
||||
$pdo = db_conn();
|
||||
|
||||
echo "[COLUMNS]\n";
|
||||
$cols = $pdo->query('SHOW COLUMNS FROM edu_contents')->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach ($cols as $c) {
|
||||
echo $c['Field'] . '|' . $c['Type'] . PHP_EOL;
|
||||
}
|
||||
|
||||
echo "\n[SAMPLES_WITH_DESC]\n";
|
||||
$rows = $pdo->query("SELECT content_id, title, description, goal_code, category_group, category_code, sort_order, is_active
|
||||
FROM edu_contents
|
||||
WHERE is_active = '1' AND CHAR_LENGTH(TRIM(COALESCE(description, ''))) >= 5
|
||||
ORDER BY updated_at DESC, created_at DESC
|
||||
LIMIT 20")->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach ($rows as $r) {
|
||||
$id = isset($r['content_id']) ? (string)$r['content_id'] : '';
|
||||
$title = isset($r['title']) ? (string)$r['title'] : '';
|
||||
$desc = isset($r['description']) ? (string)$r['description'] : '';
|
||||
$goal = isset($r['goal_code']) ? (string)$r['goal_code'] : '';
|
||||
$group = isset($r['category_group']) ? (string)$r['category_group'] : '';
|
||||
$cate = isset($r['category_code']) ? (string)$r['category_code'] : '';
|
||||
$sort = isset($r['sort_order']) ? (string)$r['sort_order'] : '';
|
||||
$active = isset($r['is_active']) ? (string)$r['is_active'] : '';
|
||||
echo $id . '|' . $title . '|' . preg_replace('/\s+/', ' ', $desc) . '|goal=' . $goal . '|group=' . $group . '|cate=' . $cate . '|sort=' . $sort . '|active=' . $active . PHP_EOL;
|
||||
}
|
||||
Reference in New Issue
Block a user