Selecting multiple fields from a table with a search term

1

I tried to follow some steps that I found here in the forum but did not give certain ...

I have this code here in Model made in codeigniter:

 // buscando clientes
     $this->db->like('nomeCliente',$termo);
     $this->db->limit(20);
     $data['clientes'] = $this->db->get('clientes')->result();

     // buscando os
     $this->db->like('idOs',$termo);
     $this->db->limit(20);
     $data['os'] = $this->db->get('os')->result();

     // buscando produtos
     $this->db->like('descricao',$termo);
     $this->db->limit(20);
     $data['produtos'] = $this->db->get('produtos')->result();

     //buscando serviços
     $this->db->like('nome',$termo);
     $this->db->limit(20);
     $data['servicos'] = $this->db->get('servicos')->result();

My question is this: in the Customers table, I need to do the search in other columns at the same time, like ptoref, citizen via a term.

For example: The system user looks for a term of name "dako", and he wants to know all OS's and customers that are related to "dako", be it products that he has ordered, that he bought and etc.

I did some variations with the code above, in which I repeated the block of the table below clients, and only modified the column, so "theoretically" should find the name Customer and also ruac, etc.

I hope I have explained my problem.

    
asked by anonymous 02.09.2016 / 20:43

1 answer

0

Very simple Jardel.

Before performing result() , you can increment as you imagine. Example:

$this->db->like('nomeCliente', $termo);
$this->db->like('nomeMae', $outroTermo);
$this->db->like('nomePai', $maisUmTermo);
$this->db->limit(20);
$data['clientes'] = $this->db->get('clientes')->result();
Who actually executes the query is the result ()
    
02.09.2016 / 21:36