on-internet
← Community

Codeigniter + MySQL - Search containing string

Stack Overflow ·

I have column in table of database with value: PL TOFLEX NEGRO/PRETO I search in my website: TOFLEX PRETO I need output: PL TOFLEX NEGRO/PRETO Can someone give me correct query to do this? I try: public function searchMaterial($nome) { $json = []; $this->load->database(); if(!empty($this->input->get("q"))){ $this->db->like('nomeMaterial', $nome, 'both'); $query = $this->db->select('idMaterial as id,nomeMaterial as text') ->limit(50) ->get("material"); $json = $query->result(); } echo json_encode($json); } but doesn't work.

Comments

Sign in or sign up to comment and upvote.

No comments yet.