2
I have that function in the models
:
function sumContasReceber() {
$this->db->select('lancamentos.*');
$this->db->from('lancamentos');
$somaCR = "SELECT SUM(valor) as SOMACR FROM
lancamentos where baixado = 0 AND tipo = 'receita'";
$resultado = mysql_query($somaCR);
return $this->db->get()->result();
}
And that function in Controllers
:
public function index() {
if((!$this->session->userdata('session_id')) || (!$this->session->userdata('logado'))){
redirect('mapos/login');
}
$this->data['somaReceber'] = $this->mapos_model->sumContasReceber();
$this->data['somaPagar'] = $this->mapos_model->sumContasPagar();
$this->data['contasPagar'] = $this->mapos_model->getContasPagar();
$this->data['contasReceber'] = $this->mapos_model->getContasReceber();
$this->data['ordens'] = $this->mapos_model->getOsAbertas();
$this->data['ordensAG'] = $this->mapos_model->getOsAgendamento();
$this->data['ordensAP'] = $this->mapos_model->getOsAguardandoPecas();
$this->data['ordensA'] = $this->mapos_model->getOsAndamento();
$this->data['produtos'] = $this->mapos_model->getProdutosMinimo();
$this->data['os'] = $this->mapos_model->getOsEstatisticas();
$this->data['estatisticas_financeiro'] = $this->mapos_model->getEstatisticasFinanceiro();
$this->data['menuPainel'] = 'Painel';
$this->data['view'] = 'mapos/painel';
$this->load->view('tema/topo', $this->data);
}
And in the Views
that:
echo 'Valor Total R$: '**aqui ta minha dificuldade**;
What I put in the View to call the result of the Model
?
I’ve tried to: $somaPagar->valor
, $somaPagar->$resultado
and a lot of bad variants always error.
Put the complete Controller code, and something else the Model method seems inconsistent to me.
– novic
Virgilio... the complete function of the Controller does not fit here in the comments... I will do in the answer.
– Jardel Dint
Ask the question.
– novic
Ready... I’m almost bald....
– Jardel Dint
what error appears?
– MagicHat
I am not able to make appear in the view the result of the account I am doing in models..
– Jardel Dint
I understood what you want, in your attempts you said that always appeared errors, appeared some error php ?
– MagicHat
yes Magichat... in all attempts, appeared that did not recognize the function or the variable did not exist... I checked N times and there was no error in typing... so I do not know what else to do.
– Jardel Dint
Place the php error,
– MagicHat
The PHP Error was encountered Severity: Notice Message: Undefined variable: result Filename: mapos/panel.php Line Number: 104 A PHP Error was encountered Severity: Notice Message: Trying to get Property of non-non-Object Filename: mapos/panel.php Line Number: 104 Total Value R$:
– Jardel Dint
In the previous attempt, I put this in the view: echo 'Total Value R$: '.$sum->$result;
– Jardel Dint
puts or points the section referring to line 104.
– MagicHat
on line 104 is this: echo 'Total Value R$: '.$sum->$result;
– Jardel Dint