It turns out that I have a problem I want to show the name of tables related to inner join in Codeigniter but it does not let me not know what I'm doing wrong.
Controller
public function consulta() {
$asociados = array("tablaAsociados" => $this->asociados_modelo->listarAsociados());
$this->load->view( 'consulta', $asociados );
}
Model
//consultamos los datos de asociados y mostraremos en tabla con datos relacionados
public function listarAsociados() {
$this->db->order_by( 'id_asociado', 'asc' );
$this->db->select('*');
$this->db->join('paises', 'paises.code = asociados.pais');
$query = $this->db->get( 'asociados' );
return $query->result_array();
}
Vista
<?php foreach ($tablaAsociados as $tabla):?>
<td><?php echo $tabla['nombre_primero'];?></td>
<td><?php echo $tabla['apellido_primero'];?></td>
<td><?php echo $tabla['dui'];?></td>
<td><?php echo $tabla['nit'];?></td>
<td><?php echo $tabla['municipio'];?></td>
<td><?php echo $tabla['departamento'];?></td>
<td><?php echo $tabla['pais'];?></td>
</tr>
<?php endforeach;?>
But it does not show me the name of the whole country only the id value of the country, in the same way I want to show the municipality and related department.