영카트5 DB테이블에 자료 저장이 안됩니다.
본문
http://www.sachul.com/shop/item.php?it_id=1518159542
견적요청 창에서 자료를 입력하고 작성저장을 클릭하면 저장되었다는
메세지는 나오는데 실제 테이블에는 자료가 저장되지 않습니다.
뭐가 문제일까요?
상품문의(qa)와 동일한 구조의 폼(회사명 추가)과 동일한 구조의 테이블을 사용하고 있습니다.
<?php
include_once('./_common.php');
if (!$is_member) {
alert_close("견적요청은 회원만 작성이 가능합니다.");
}
$qt_id = (int) trim($_REQUEST['qt_id']);
$qt_company = trim($_POST['qt_company']);
$qt_subject = trim($_POST['qt_subject']);
$qt_question = trim($_POST['qt_question']);
$qt_answer = trim($_POST['qt_answer']);
$hash = trim($_REQUEST['hash']);
$get_editor_img_mode = $config['cf_editor'] ? false : true;
if ($w == "" || $w == "u") {
$qt_name = addslashes(strip_tags($member['mb_name']));
$qt_password = $member['mb_password'];
if (!$qt_company) alert("회사명을 입력하여 주십시오.");
if (!$qt_subject) alert("제목을 입력하여 주십시오.");
if (!$qt_question) alert("요청내용을 입력하여 주십시오.");
}
if($is_mobile_shop)
$url = './iteminfo.php?it_id='.$it_id.'&info=quotation';
else
$url = "./item.php?it_id=$it_id&_=".get_token()."#sit_qt";
if ($w == "")
{
$sql = "insert {$g5['g5_shop_item_quotation_table']}
set it_id = '$it_id',
mb_id = '{$member['mb_id']}',
qt_secret = '$qt_secret',
qt_name = '$qt_name',
qt_company = '$qt_company',
qt_email = '$qt_email',
qt_hp = '$qt_hp',
qt_password = '$qt_password',
qt_subject = '$qt_subject',
qt_question = '$qt_question',
qt_time = '".G5_TIME_YMDHIS."',
qt_ip = '$REMOTE_ADDR' ";
sql_query($sql);
$alert_msg = '견적요청이 등록 되었습니다.';
}
else if ($w == "u")
{
if (!$is_admin)
{
$sql = " select count(*) as cnt from {$g5['g5_shop_item_quotation_table']} where mb_id = '{$member['mb_id']}' and qt_id = '$qt_id' ";
$row = sql_fetch($sql);
if (!$row['cnt'])
alert("자신의 제품문의만 수정하실 수 있습니다.");
}
$sql = " update {$g5['g5_shop_item_quotation_table']}
set qt_secret = '$qt_secret',
qt_company = '$qt_company',
qt_email = '$qt_email',
qt_hp = '$qt_hp',
qt_subject = '$qt_subject',
qt_question = '$qt_question'
where qt_id = '$qt_id' ";
sql_query($sql);
$alert_msg = '견적요청이 수정 되었습니다.';
}
else if ($w == "d")
{
if (!$is_admin)
{
$sql = " select qt_answer from {$g5['g5_shop_item_quotation_table']} where mb_id = '{$member['mb_id']}' and qt_id = '$qt_id' ";
$row = sql_fetch($sql);
if (!$row)
alert("자신의 견적요청만 삭제하실 수 있습니다.");
if ($row['qt_answer'])
alert("답변이 있는 견적요청은 삭제하실 수 없습니다.");
}
// 에디터로 첨부된 이미지 삭제
$sql = " select qt_question, qt_answer from {$g5['g5_shop_item_quotation_table']} where qt_id = '$qt_id' and md5(concat(qt_id,qt_time,qt_ip)) = '{$hash}' ";
$row = sql_fetch($sql);
$imgs = get_editor_image($row['qt_question'], $get_editor_img_mode);
for($i=0;$i<count($imgs[1]);$i++) {
$p = parse_url($imgs[1][$i]);
if(strpos($p['path'], "/data/") != 0)
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
else
$data_path = $p['path'];
if( preg_match('/(gif|jpe?g|bmp|png)$/i', strtolower(end(explode('.', $data_path))) ) ){
$destfile = ( ! preg_match('/\w+\/\.\.\//', $data_path) ) ? G5_PATH.$data_path : '';
if($destfile && preg_match('/\/data\/editor\/[A-Za-z0-9_]{1,20}\//', $destfile) && is_file($destfile))
@unlink($destfile);
}
}
$imgs = get_editor_image($row['qt_answer'], $get_editor_img_mode);
for($i=0;$i<count($imgs[1]);$i++) {
$p = parse_url($imgs[1][$i]);
if(strpos($p['path'], "/data/") != 0)
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
else
$data_path = $p['path'];
if( preg_match('/(gif|jpe?g|bmp|png)$/i', strtolower(end(explode('.', $data_path))) ) ){
$destfile = ( ! preg_match('/\w+\/\.\.\//', $data_path) ) ? G5_PATH.$data_path : '';
if($destfile && preg_match('/\/data\/editor\/[A-Za-z0-9_]{1,20}\//', $destfile) && is_file($destfile))
@unlink($destfile);
}
}
$sql = " delete from {$g5['g5_shop_item_quotation_table']} where qt_id = '$qt_id' and md5(concat(qt_id,qt_time,qt_ip)) = '{$hash}' ";
sql_query($sql);
$alert_msg = '견적요청이 삭제 되었습니다.';
}
if($w == 'd')
alert($alert_msg, $url);
else
alert_opener($alert_msg, $url);
?>
답변 2
$g5['g5_shop_item_quotation_table']
테이블명이 이건데 혹시 아래 작업하셨나요?
실제 테이블 = g5_shop_item_quotation
/data/dbconfig.php
$g5['g5_shop_item_quotation_table'] = G5_SHOP_TABLE_PREFIX.'item_quotation';
!-->
배모씨님, 감사합니다.
말씀하신것처럼 dbconfig.php파일에 등록을 하니 데이터가 저장이 됩니다.
좋은 하루 되세요.
답변을 작성하시기 전에 로그인 해주세요.