You just try this as follows:
$this->db->select('*') $this->db->from('table'); $this->db->like('column', $keyword); return $this->db->get()->result_array();
If you want to control where the pattern (%) is located, you can use the optional third argument. Your options are "before", "after" and "both" (default).
Example:
$this->db->select('*') $this->db->from('table'); $this->db->like('column', $keyword, 'before'); return $this->db->get()->result_array();
If you do not want to use the wildcard character (%), you can go to the optional third argument with the "none" option.
Example:
$this->db->select('*') $this->db->from('table'); $this->db->like('column', $keyword, 'none'); return $this->db->get()->result_array();
BUT, for your example, you need to search, for example, "%keyword sample%" , or as "%keyword%" OR "%simple%" ;
For example:
$this->db->like('column', 'keyword simple');
OR
$this->db->like('column', 'keyword'); $this->db->or_like('column', 'simple');
For more details, you can read the CodeIgniter User Guide
Erman belegu
source share