1
Gentlemen, I have the following function:
// Busca Simples
public function buscando(){
// pesquisar_palavra, idCategoria, idSubCategoria
if($this->input->post('pesquisar_palavra')){
$this->db->like('noticia.titulo', $this->input->post('pesquisar_palavra'));
}
if($this->input->post('idCategoria')){
$this->db->select('noticia.*, categoria.categoria');
$this->db->join('categoria', "categoria.id=noticia.id");
$this->db->where('categoria.id', $this->input->post('idCategoria'));
}
if($this->input->post('idSubCategoria')){
$this->db->where('noticia.id_categoria', $this->input->post('idSubCategoria'));
}
$this->db->where('noticia.ativo', 1);
$this->db->order_by('noticia.data', 'DESC');
$this->db->order_by('noticia.id', 'DESC');
$consulta = $this->db->get('noticia')->result();
echo "<pre>";
print_r($consulta);
echo "</pre>";
die();
}
His return is just a record, not 3, as shown in the following database:
This is the Search Post criterion.
Array
(
[pesquisar_palavra] =>
[idCategoria] => 1
[idSubCategoria] => 5
)
Hi, could give more information regarding the problem, as the structure of the tables.
– Yure Pereira