퍼스트가든에서 사용하는 사용자 함수 및 관련파일 추가
This commit is contained in:
56
manager/ticket/adm_category.update.php
Normal file
56
manager/ticket/adm_category.update.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// 매표소 업무일지 목록 항목 업데이트
|
||||
if ( !isset($_POST) ) exit;
|
||||
include_once "_common.php";
|
||||
|
||||
$isDebug = false;
|
||||
|
||||
$table = $fg['visitor_category_table'];
|
||||
|
||||
if ($isDebug) var_dump($_POST);
|
||||
|
||||
if ( isset($_POST['mode']) ) { //mode가 선언되어야만 코드 실행
|
||||
$cat01 = isset($_POST['cat01']) ? trim($_POST['cat01']) : '';
|
||||
$cat02 = isset($_POST['cat02']) ? trim($_POST['cat02']) : '';
|
||||
$cat03 = isset($_POST['cat03']) ? trim($_POST['cat03']) : '';
|
||||
$name = isset($_POST['name']) ? trim($_POST['name']) : '';
|
||||
$code = isset($_POST['code']) ? trim($_POST['code']) : '';
|
||||
$unit_price = isset($_POST['unit_price']) ? trim($_POST['unit_price']) : 0;
|
||||
$used = isset($_POST['used']) ? trim($_POST['used']) : 1; // 사용여부가 선언되지 않았다면 무조건 사용 으로 체크함
|
||||
|
||||
if ($_POST['mode'] == 'add') { // add로 넘어온 경우
|
||||
$query = "INSERT INTO {$table}
|
||||
(cat01, cat02, cat03, code, name, unit_price, used)
|
||||
VALUES ('{$cat01}', '{$cat02}', '{$cat03}', '{$code}', '{$name}', '{$unit_price}', '{$used}' )";
|
||||
|
||||
if ($isDebug) echo 'query : '. $query;
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
} else if ($_POST['mode'] == 'modify') { // 수정인 경우
|
||||
$idx = isset($_POST['idx']) ? trim($_POST['idx']) : ''; // 수정에서만 사용됨
|
||||
|
||||
$query = "UPDATE {$table} SET
|
||||
cat01 = '{$cat01}',
|
||||
cat02 = '{$cat02}',
|
||||
cat03 = '{$cat03}',
|
||||
code = '{$code}',
|
||||
name = '{$name}',
|
||||
unit_price = '{$unit_price}',
|
||||
used = '{$used}'
|
||||
WHERE idx = '{$idx}'
|
||||
";
|
||||
|
||||
if ($isDebug) echo 'query : '. $query;
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
}
|
||||
|
||||
if ( isset($result) && $result ) {
|
||||
alert('저장완료', false);
|
||||
} else {
|
||||
alert('오류가 발생하였습니다');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user