CodeIgniter Forums
no data is passing to the view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: no data is passing to the view (/showthread.php?tid=50693)



no data is passing to the view - El Forum - 04-04-2012

[eluser]SamoualSys[/eluser]
the controler
Code:
function totaltrans()
  {
  
    $this->load->model('report_model');
    $results = $this->report_model->total_trans_num();
    $data['films'] = $results['rows'];
  $data['num_results'] = "My Real Title";; // this for test the result in the view
    $this->load->view('report',$data);
  }
the model
Code:
function total_trans_num ()
      {
       // results query
  $q = $this->db->select('recev_name,Send_amount,Cur_rate,Recev_amount,User_name,Recev_country,Sender_country,Sender_name,Cur_recev,Cur_send,Op_time,ID')
   ->from('trans')
   ->limit($limit, $offset)
   ->order_by($sort_by, $sort_order);
  
  $ret['rows'] = $q->get()->result();
       // count query
  $q = $this->db->select('COUNT(*) as count', FALSE)
   ->from('trans');
  
  $tmp = $q->get()->result();
  
  $ret['num_rows'] = $tmp[0]->count;
  
  return $ret;
in the view iam just showing the
Code:
<p>&lt;?echo $num_results;?&gt;</p>
it come with this error
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: num_results

Filename: views/report.php

Line Number: 34