I can not pass array loop for view.
each result has one or more positions, however pass in view one position.
I used, example:
$data['atualiza'] = $totaliza;
$this->load->view(myView, $data);
this no work, only the first array value;
foreach ($vetor as $xvet => $valuevetor)
{
//TOTALIZA
foreach ($complementar->result() as $key => $value)
{
$totaliza = $this->db->query("select professor, sum(cargah) as soma from cmcg_registros where id_disciplina = '$idsic' and id_professor =". $valuevetor."group by professor")->result();
}
foreach ($complementar->result() as $key => $value)
{
for ($i=0; $i < $key ; $i++)
{
$consulta = $this->db->query("select professor, id_disciplina, cargah, cargah_local from cmcg_registros where id_disciplina = '$idsic' and id_professor =". $valuevetor."group by professor, id_disciplina, cargah, cargah_local")->result();
}
}
echo 'TOTALIZA';
echo '<pre>';
print_r($totaliza);
echo '</pre>';
echo '<br><hr>';
echo '<pre>';
print_r($consulta);
echo '</pre>';
}
show
TOTALIZA
Array
(
[0] => stdClass Object
(
[professor] => LUIZ AUGUSTO DA SILVA OLIVEIRA
[soma] => 90
)
)
Array
(
[0] => stdClass Object
(
[professor] => LUIZ AUGUSTO DA SILVA OLIVEIRA
[id_disciplina] => 19
[cargah] => 5
[cargah_local] => 701
)
[1] => stdClass Object
(
[professor] => LUIZ AUGUSTO DA SILVA OLIVEIRA
[id_disciplina] => 19
[cargah] => 5
[cargah_local] => 702
)
[2] => stdClass Object
(
[professor] => LUIZ AUGUSTO DA SILVA OLIVEIRA
[id_disciplina] => 19
[cargah] => 5
[cargah_local] => 703
)
)
Thanks guys!