db_onedev = $this->load->database("nasional", true); } function checkCompanyNasionalExist($code){ try { $sql = "select count(*) as x from m_company where M_CompanyNatCode = '{$code}' AND M_CompanyIsActive = 'Y'"; //echo $sql; $row = $this->db_onedev->query($sql)->row(); //echo $this->db_onedev->last_query(); $rtn = FALSE; if($row->x > 0 ) $rtn = TRUE; $result = array ("exist" => $rtn); $this->sys_ok($result); } catch(Exception $exc) { $message = $exc->getMessage(); $this->sys_error($message); } } }