load->library('session'); $this->load->library('rhlib'); } function retValOrNull($val){ //especially for combo & looukup with no item selected $val = ($val=='')? null : $val; return $val; } function get_klsparalel(){ $q = "SELECT * FROM klsparalel"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_klsparalel(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('klsparalel',$dataArray); return $ret; } function update_klsparalel(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE $where['klsparalel'] = $_POST['klsparalel']; $this->db->where('klsparalel', $_POST['klsparalel']); $this->db->update('klsparalel', $fieldsAndValues); if($this->db->affected_rows()){ $ret["success"]=true; $ret["msg"]='Update Data Berhasil'; }else{ $ret["success"]=false; $ret["msg"]= 'Update Data Gagal'; } return $ret; } function delete_klsparalel(){ $where['klsparalel'] = $_POST['klsparalel']; $ret = $this->rhlib->deleteRecord('klsparalel',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( 'klsparalel'=> $_POST['klsparalel'], ); return $dataArray; } } ?>