db_onedev = $this->load->database("onedev", true); $this->load->helper(array('form', 'url')); } function save() { $prm = $this->sys_input; $userid = $this->sys_user["M_UserID"]; if (! $this->isLogin) { $this->sys_error("Invalid Token"); exit; } $orderID = $prm["orderID"]; $url = $prm["url"]; $type = $prm["type"]; $format = $prm["format"]; $re_id = $prm["re_id"]; $sql = "insert into t_email_nonlab(T_EmailNonLabT_OrderHeaderID,T_EmailNonLabType, T_EmailNonLabFormat, T_EmailNonLabUrl,T_EmailNonLabResultEntryID) values(?,?,?,?,?) on duplicate key update T_EmailNonLabFormat = ? , T_EmailNonLabUrl = ?, T_EmailNonLabResultEntryID = ? "; $query= $this->db_onedev->query($sql,array($orderID, $type,$format, $url, $re_id, $format, $url, $re_id)); if ($query) { $this->sys_ok(""); exit; } $msg = array( "message" => print_r($this->db_onedev->error(), true) , "query" => $this->db_onedev->last_query() ); $this->sys_error($msg); } function get() { $prm = $this->sys_input; if (! $this->isLogin) { $this->sys_error("Invalid Token"); exit; } $orderID = $prm["orderID"]; $type= $prm["type"]; $sql = "select * from t_email_nonlab where T_EmailNonLabT_OrderHeaderID = ? and T_EmailNonLabType=?"; $qry = $this->db_onedev->query($sql, array($orderID,$type)) ; $rows = array(); if ($qry) { $rows = $qry->result_array(); } $this->sys_ok($rows); } }