Files
sam-kd/output/fetch_date.php
hskwon aca1767eb9 초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
2025-12-10 20:14:31 +09:00

40 lines
1.4 KiB
PHP

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
$pdo = db_connect();
$month = $_POST['month'];
$year = $_POST['year'];
$dateType = $_POST['dateType']; // 'outdate'
$data_order = array();
try {
$stmh = $pdo->prepare("SELECT num, con_num, outdate, indate, outworkplace, orderman, outputplace, receiver, phone, comment, root, steel, motor, delivery, regist_state, bend_state, motor_state, searchtag, update_log, screen, screen_state, screen_su, screen_m2, screenlist, slatlist, slat, slat_state, slat_su, slat_m2, updatecomment, secondord
FROM " . $DB . ".output
WHERE (is_deleted IS NULL or is_deleted = '0') and (devMode <> '1' OR devMode IS NULL)
AND MONTH($dateType) = :month
AND YEAR($dateType) = :year");
$stmh->bindValue(':month', $month);
$stmh->bindValue(':year', $year);
$stmh->execute();
while ($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
array_push($data_order, $row);
}
$data_order = array(
"data_order" => $data_order,
"month" => $month,
"dateType" => $dateType,
"year" => $year
);
echo json_encode($data_order, JSON_UNESCAPED_UNICODE);
} catch (PDOException $Exception) {
print "오류: " . $Exception->getMessage();
}
?>