퍼스트가든에서 사용하는 사용자 함수 및 관련파일 추가
This commit is contained in:
26
manager/bakery/bakery_stock.ajax.author.update.php
Normal file
26
manager/bakery/bakery_stock.ajax.author.update.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
include_once '_common.php';
|
||||
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") { // POST로 넘어온 값이 있다면
|
||||
// 변수 선언
|
||||
$date = trim($_POST["searchDate"]);
|
||||
$worker = trim($_POST['worker']);
|
||||
$author = trim($_POST['author']);
|
||||
|
||||
// update query
|
||||
$query = "INSERT INTO {$fg['bakery_author_table']} (date, worker, author) ";
|
||||
$query .= "VALUES('{$date}', '{$worker}', '{$author}') ";
|
||||
// 이미 값이 있는 경우 업데이트함
|
||||
$query .= "ON DUPLICATE KEY UPDATE worker = '{$worker}', author = '{$author}' ";
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
if ($result) {
|
||||
echo json_encode(array('success' => true));
|
||||
} else {
|
||||
echo json_encode(array('success' => false, 'message' => 'Database error'));
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array('success' => false, 'message' => 'Invalid request method'));
|
||||
}
|
||||
Reference in New Issue
Block a user