Query result in codeigniter save in session display different results when used in controller functions using var_dump -


i have used codeigniter session save result database query in model, first time have used var_dump function view result save in session variable , it's okay used thesame session display result other function in controller display last row of result not results save in session.

**students controller**  function get_student(some parameters) { $print_result=  $this->course_booking_model->get_student_ajax($config["per_page"],$page,$result,$tennant_id,$sort_by,$sort_order); $this->session->set_userdata('print_result',$print_result); $data['data_student'] = $this->session->userdata('print_result'); var_dump($this->session->userdata('print_result')); } 

another function within thesame controller

function export_students() { $data['data_print']=$this->session->userdata('print_result'); $this->load->view('view_students_pdf',$data); var_dump($this->session->userdata('print_result')); } 

the var_dump function have different outputs

try approach:

controller function 1:

$query = $this->course_booking_model->get_student_ajax($config["per_page"],$page,$result,$tennant_id,$sort_by,$sort_order);   $new_data=array(    'pdf_data' => $query   );    $this->session->set_userdata($new_data);   var_dump($this->session->userdata('pdf_data')); 

controller function 2:

$data=$this->data; $tennant_code=$this->session->userdata('username');  $query=$this->session->userdata('pdf_data'); var_dump($query); 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -