In my page index
, I have a input
search for the user to search the data in the database, this input
calls this method in Controller
:
public function pesquisar()
{
$this->load->model('Processo_model', 'processo');
$dados['processo'] = $this->processo->get_processos_like();
if (!$this->processo->get_processos_like())
{
$this->load->view('/listar/listar_processo', $dados);
} else {
redirect('dashboard', 'refresh');
}
}
In the model is thus the method code:
function get_processos_like()
{
$termo = $this->input->post('pesquisar');
$this->db->join('andamento', 'fkcodprocesso=codprocesso', 'inner');
$this->db->select('*');
$this->db->where('nprocesso', $termo);
return $this->db->get('processo')->result();
}
And in the view, it looks like this:
<?php foreach ($processo as $proc) { ?>
<table>
<tr class="row">
<td><?= $proc->dtandamento; ?></td>
<td><?= $proc->descricao; ?></td>
</tr>
<?php } ?>
</table>
What happens, is that when the process (from the Processes table) does not yet have progress (from the Movements table), the search returns me null, or does not return anything to me. I would like you to display the process data even though it has no registered progress.
I've tried using LEFT JOIN
but it did not work.