초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
24
KDunitprice/fetch_lotnum.php
Normal file
24
KDunitprice/fetch_lotnum.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
|
||||
header("Content-Type: application/json"); // JSON 형식으로 응답하기 위해 설정
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
$sql = "SELECT lotnum FROM $DB.material_lot WHERE is_deleted IS NULL ORDER BY registedate DESC";
|
||||
|
||||
try {
|
||||
$stmh = $pdo->query($sql);
|
||||
$lotnums = [];
|
||||
|
||||
while ($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
|
||||
$lotnums[] = $row['lotnum'];
|
||||
}
|
||||
$lotnums[] = '초기로트' ;
|
||||
|
||||
echo json_encode(['lotnums' => $lotnums], JSON_UNESCAPED_UNICODE);
|
||||
} catch (PDOException $Exception) {
|
||||
echo json_encode(['error' => $Exception->getMessage()], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user