I am putting values in a array
and need to display those values on the side of the titles in the th
of a table
.
I do not want to use a loop to go through the array, I want to access the value by the index.
Here is my function that feeds array
and sends to view
public function index() {
$novas = $this->model->countSituacaoNova();
$analise = $this->model->countSituacaoAnalise();
$aprovada = $this->model->countSituacaoAprovada();
$reprovada = $this->model->countSituacaoReprovada();
$pendente = $this->model->countSituacaoPendente();
$paga = $this->model->countSituacaoPaga();
$data = array(
'novas' => $novas,
'analise' => $analise,
'aprovada' => $aprovada,
'reprovada' => $reprovada,
'pendente' => $pendente,
'paga' => $paga
);
$situacoes['situacao'] = $data;
//var_dump($data);
$this->load->view('propostas_view', $situacoes);
}
Here is an excerpt of view
with table
in which I try to use the value of array
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Em análise (<?php echo $situacao['novas']; ?>)</th>
<th>Aprovadas</th>
<th>Reprovadas</th>
<th>Pendentes</th>
<th>Pagas</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
My array
$novas
has this:
array (size=1)
0 =>
object(stdClass)[22]
public 'Novas' => string '1' (length=1)
Error:
Message: Array to string conversion