I'm in the struggle of a system in php and mysql system sales etc ... it is all working, however accurate at the time of sale, the person can search for either (idCode or Description). without having two tabs of search. wanted to put two LIKE to search for (idCode, Description) would soon have an OR in the middle but not to achieve. Follow the Code Working with Search only with DESCRIPTION
public function autoCompleteProdutoSaida($q){
$this->db->select('*');
$this->db->limit(5);
$this->db->like('descricao', $q); "no caso aqui teria que ter um OR e um LIKE, porém não estou acertando."
$this->db->where('saida',1);
$query = $this->db->get('produtos');
if($query->num_rows() > 0){
foreach ($query->result_array() as $row){
$row_set[] = array('label'=>$row['idCodigo']. ' | '.$row['descricao'].' | Preço: R$ '.$row['precoVenda'].' | Estoque: '.$row['estoque'],'estoque'=>$row['estoque'],'id'=>$row['idProdutos'],'preco'=>$row['precoVenda']);
}
echo json_encode($row_set);
}
}