Welcome Guest, Not a member yet? Register   Sign In
no data is passing to the view
#1

[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




Theme © iAndrew 2016 - Forum software by © MyBB