Riandy Riandy -4 years ago 108
MySQL Question

Cannot Show Variable Codeigniter

Any one can help me I got stuck in this error I'm using Codeigniter :

Call to undefined method M_data::getTotalSales()

an here's my Code so far :

Model Model

View View

Answer Source

I think your mistake is passing data in view,

in codeigniter you have to pass data like this :

In controller file:

$data['hasilSemua'] = $this->m_data->getTotalSales();
$this->load->view('v_dashboard', $data);

Access in view:

foreach($hasilSemua as $val){

Try this pattern , May be it helps you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download