$this->result = $this->db->get('ca_brand',$mmax, 0); if ($this->result) { return true; } else { return false; }Query table with like filter:
$this->db->like('name', $keyword); // buildin mysql escape $this->result = $this->db->get('ca_brand',0, $mmax); if ($this->result) { return true; } else { return false; }Insert row in table:
// buildin mysql escape character $data = array('name' => $name); $this->db->insert('ca_brand', $data); // return true on success $insert_id = $this->db->insert_id(); // get id
Update row in table for spesific id
// buildin mysql escape character $id = intval($id); $data = array ('name' => $name); $this->db->where('id', $id); //$this->db->update('ca_brand',$data, "id = "$id ); // option 1 $this->db->update('ca_brand',$data); // // option 2 $numaffectedrow = $this->db->affected_rows(); // to get nummber affected rowDelete row:
$id = intval($id); $this->db->where('id', $id); $this->db->delete('ca_brand'); $numaffectedrow = $this->db->affected_rows(); // to get nummber affected rowPhp 7.2 and Codeigniter 3.1.10