'9999', 'MSG'=>''); try { $sql = "insert into car_grade SET cd_model_sub = '$cd_model_sub' , nm_grade = '$nm_grade' , ds_status = 'A0' , dt_insert = now() , nm_insert = '$cd_userid' , dt_update = now() , nm_update = '$cd_userid' , ds_delind = 'N' "; $result = mysql_query($sql,$connect); if(!$result) { throw new Exception("입력 실패 하였습니다.", "9990"); } $RES['CODE'] = "0000"; $RES['MSG'] = "정상"; }catch(Exception $e){ $RES['CODE'] = $e->getCode(); $RES['MSG'] = $e->getMessage(); } @mysqli_close($connect); echo json_encode($RES); exit; break; //글수정 case "Update": include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php'; $RES = array('CODE'=>'9999', 'MSG'=>''); try { $sql = "UPDATE car_grade SET cd_model_sub = '$cd_model_sub' , nm_grade = '$nm_grade' , dt_update = now() , nm_update = '$cd_userid' , ds_delind = 'N' WHERE cd_grade = '$cd_grade' "; $result = mysql_query($sql,$connect); if(!$result) { throw new Exception("수정 실패 하였습니다.", "9990"); } $RES['CODE'] = "0000"; $RES['MSG'] = "정상"; }catch(Exception $e){ $RES['CODE'] = $e->getCode(); $RES['MSG'] = $e->getMessage(); } @mysqli_close($connect); echo json_encode($RES); exit; break; //글삭제 처리 case "Delete" : include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php'; $RES = array('CODE'=>'9999', 'MSG'=>''); try { $sql = "UPDATE car_grade SET dt_update = now() , nm_update = '$cd_userid' , ds_delind = 'Y' WHERE cd_grade = '$cd_grade' "; $result = mysql_query($sql,$connect); if(!$result) { throw new Exception("삭제에 실패 하였습니다.", "9990"); } $RES['CODE'] = "0000"; $RES['MSG'] = "정상"; }catch(Exception $e){ $RES['CODE'] = $e->getCode(); $RES['MSG'] = $e->getMessage(); } @mysqli_close($connect); echo json_encode($RES); exit; break; default : AlertRedirect("지정되지않은 요청입니다","index.php?ds_cate=$ds_cate"); break; } mysql_close($connect); ?>