Files
sam-kd/output/fetch_estimate_details.php

28 lines
923 B
PHP
Raw Normal View History

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
// Assuming $DB is defined in mydb.php or session.php
if (!isset($DB)) {
$DB = 'chandj'; // 실제 데이터베이스 이름으로 대체하세요.
}
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
$pdo = db_connect();
$estimateId = $_POST['estimateId'];
try {
$sql = "SELECT * FROM {$DB}.estimate WHERE num = :estimateId";
$stmh = $pdo->prepare($sql);
$stmh->bindParam(':estimateId', $estimateId, PDO::PARAM_INT);
$stmh->execute();
$estimateDetails = $stmh->fetchAll(PDO::FETCH_ASSOC);
// 데이터를 JSON 형식으로 반환
header('Content-Type: application/json');
echo json_encode($estimateDetails);
} catch (PDOException $e) {
echo json_encode(['error' => '데이터를 가져오는 중 오류가 발생했습니다: ' . $e->getMessage()]);
}
?>