Initial commit: 교육 프로젝트 배포
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
require_once '../../bbs/db_conn.php';
|
||||
|
||||
// PDO 연결 생성
|
||||
$pdo = db_conn();
|
||||
|
||||
try {
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
$base_year = $input['base_year'] ?? '';
|
||||
$start_date = $input['start_date'] ?? '';
|
||||
$end_date = $input['end_date'] ?? '';
|
||||
|
||||
if (empty($base_year) || empty($start_date) || empty($end_date)) {
|
||||
echo json_encode(['success' => false, 'message' => '?꾩닔 ?뚮씪誘명꽣媛 ?꾨씫?섏뿀?듬땲??']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// edu_contents ?뚯씠釉붿뿉??踰뺤젙援먯쑁(CA10003) 移댄뀒怨좊━ ??ぉ ?낅뜲?댄듃
|
||||
$stmt = $pdo->prepare("
|
||||
UPDATE edu_contents
|
||||
SET
|
||||
start_date = ?,
|
||||
end_date = ?,
|
||||
updated_at = NOW()
|
||||
WHERE 1=1
|
||||
AND category_code = 'CA10003'
|
||||
AND base_year = ?
|
||||
");
|
||||
|
||||
$result = $stmt->execute([$start_date, $end_date, $base_year]);
|
||||
|
||||
if ($result) {
|
||||
echo json_encode(['success' => true]);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'message' => '????ㅽ뙣']);
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user