0
I’m having a problem updating a bank record by codeigniter, I have two tables, one call:
employee(where the employees of the company are stored and in which sector the employee works,this table has the foreign key of the sector table(id_sector)
And the other call: sector (where it stores enterprise sectors)
I can update the information by the forms without error, including updates in the bank also, however, the listing in the system shows the old sector of the employee and not the new recently updated, for example:
João da silva - Collection, update to administration (update the new sector in the bank) when I redirect to the system listing and João da Silva is still in the collection sector.
Code of the model employed, where I join the tables(sector and employee), to show the names of the sectors of the system listing
public function ListarEmpregado(){
$this->db->select('e.id_empregado, e.nome_empregado,e.salario, s.nome');
$this->db->from('empregado as e');
$this->db->join('setor as s','s.id_setor = e.id_empregado');
$this->db->order_by('nome_empregado');
$query = $this->db->get();
return $query->result();
}
Employee update code(employed template):
public function atualizarinfosempregado($id,$array){
$this->db->where('id_empregado',$id);
$this->db->update('empregado',$array);
}
Listing(index_company.php):
<?php foreach($empregado as $e){ ?>
<tr>
<td><?php echo $e->id_empregado ?></td>
<td><?php echo $e->nome_empregado ?></td>
<td><?php echo $e->salario ?></td>
<td><?php echo $e->nome ?></td>
<td><a href="#" class="empregado" id="<?php echo $e->id_empregado; ?>">Deletar</a></td>
<td><a href="http://localhost/CodeIgniter-3.1.3/CodeIgniter-3.1.3/index.php/IndexController/idempregado/<?php echo $e->id_empregado; ?>">Atualizar</a></td>
</tr>
I wonder what’s missing? Thanks for your help :)
It worked, it was a very silly mistake Thank you very much
– Guilherme