0
I’m doing a list application of patients for surgery and using the CodeIgniter
and Bootstrap
. My doubt is how to make a select in the database query so that it shows me in the table only the results that do not have the status_paciente = "realizado"
I’m not using the model to make the query for now, I added on own controler
. The table in use is the "patients" and the patient I do not want to show in select is the one that has the "status_patient" value = "performed".
Man Controler
:
public function index()
{
$this->db->select('*');
$this->db->join('medico','id_medico=idMedico','inner');
$dados['paciente'] = $this->db->get('paciente')->result();
$this->load->view('includes/html_header');
$this->load->view('includes/menu');
$this->load->view('listar_paciente', $dados);
$this->load->view('includes/html_footer');
}
My View:(just the part where this table showing the query data)
<h4>Lista de Pacientes</h4>
<div class="table-responsive">
<table class="table table-striped table-sm" id="myTable">
<thead>
<tr>
<th hidden>ID</th>
<th>Ordem</th>
<th style="width:100px">Data</th>
<th>Prontuario</th>
<th>Nome</th>
<th>Sexo</th>
<th>Procedimento</th>
<th>OPME</th>
<th>Observações</th>
<th>LAB</th>
<th>Risco</th>
<th>Raio X</th>
<th>Outros</th>
<th>Médico</th>
<th>Status</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($paciente as $pac){?>
<tr>
<td hidden><?= $pac->id; ?></td>
<td><?= $pac->ordem; ?></td>
<td><?= date('d/m/y',strtotime($pac->data)); ?></td>
<td><?= $pac->prontuario; ?></td>
<td><?= $pac->nome; ?></td>
<td><?= $pac->sexo=='m'?'Masculino':'Feminino'; ?></td>
<td><?= $pac->procedimento; ?></td>
<td><?= $pac->opme; ?></td>
<td><?= $pac->observacoes; ?></td>
<td><?= $pac->lab; ?></td>
<td><?= $pac->risco; ?></td>
<td><?= $pac->raiox; ?></td>
<td><?= $pac->outros; ?></td>
<td><?= $pac->abreviacao; ?></td>
<td><?= $pac->status_paciente; ?></td>
<td>
<a href="<?= base_url('nir/alterar/'. $pac->id)?>" class="btn btn-primary btn-group">Atualizar</a></td>
<td><a href="<?= base_url('nir/excluir/'. $pac->id)?>" class="btn btn-danger btn-group" onclick="return confirm('Deseja Realmente Remover Este Paciente?')">Remover</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
I couldn’t do it that way, but thanks for the reply, I followed Luiz Fernando’s tip
– matheus abreu