I'm trying to show the name of a provider, as well as the name of the garden instead of its id from the table entries.
The problem is that I do not know how the syntax is in Codeigniter
to bring and show that data.
Model:
public function getEntradas(){
$this->db->join('proveedor', 'proveedor.id = entrada.PROVEEDOR');
$result = $this->db->get('entrada');
return $result->result();
}
Controller:
$data = array(
'entradas' => $this->Modelfruta->getEntradas()
);
$this->load->view('content/head');
$this->load->view('content/aside');
$this->load->view('pages/proceso/fruta/viewfruta',$data);
$this->load->view('content/footer');
$this->load->view('content/scrips/proceso/srcontrols');
View:
<?php if(!empty($entradas)): ?>
<?php foreach($entradas as $entradas): ?>
<tr role="row" class="odd">
<td tabindex="0" class="sorting_1"><?php echo $entradas->id; ?></td>
<td><img src="<?php echo base_url(); ?>assets/images/profile.png" class="avatar" alt="Avatar"><span style="margin-left:10px;"></span><?php echo $entradas->PROVEEDOR; ?></td>
<td><?php echo $entradas->peso; ?></td>
<td><?php echo $entradas->cajas; ?></td>
<td><?php echo $entradas->hora; ?></td>
<td><a href="" class="btn btn-danger btn-xs btn-remove">No impreso</a></td>
<td><button type="button" class="btn btn-primary btn-xs">Ingresado</button></td>
<td><a href="" class="btn btn-warning btn-xs">Modificar</a>
<a href="" class="btn btn-danger btn-xs btn-remove">Eliminar</a>
</td>
</tr>
<?php endforeach; ?>
Columns of my table:
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 100px;" aria-sort="ascending" aria-label="Name: activate to sort column descending">#</th>
<th class="sorting" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 200px;" aria-label="Position: activate to sort column ascending">Proveedor</th>
<th class="sorting" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 100px;" aria-label="Office: activate to sort column ascending">Peso</th>
<th class="sorting" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 100px;" aria-label="Age: activate to sort column ascending">Cajas</th>
<th class="sorting" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 100px;" aria-label="Start date: activate to sort column ascending">Hora</th>
<th class="sorting" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 100px;" aria-label="Start date: activate to sort column ascending">Impresion</th>
<th class="sorting" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 100px;" aria-label="Start date: activate to sort column ascending">Etapa procesada</th>
<th class="sorting" tabindex="0" aria-controls="datatable-buttons" rowspan="1" colspan="1" style="width: 100px;" aria-label="Salary: activate to sort column ascending">Herramientas</th></tr>
</thead>
How can I show the name? As I currently have it, it does not show me anything.