Welcome Guest, Not a member yet? Register   Sign In
Problem with Pagination Killing session userdata
#1

[eluser]gazza7364[/eluser]
Hi

I have a problem with pagination, which is destroying session userdata, then sending me back to the logon page.

Everything works when I press next and previos pages until I go back to the first page. This then destroys my session userdata, sending me to the logon page.

Any ideas?





Controller

Code:
function display(){
// load pagination library

$this->load->library('pagination');
$this->load->library('table');;
// set pagination parameters
$config['base_url']='http://localhost/blog/index';
$config['total_rows']=$this->blog_mysql->mycount();
$config['per_page']='3';
$config['num_links']='3';
$config['last_link'] = 'Last';
$config['first_link'] = 'First';
$config['full_tag_open'] = '<div class="pagination">';
$config['full_tag_close'] = '</div>';

$this->pagination->initialize($config);

//$data['result'] = $this->db->get('blog', $config['per_page'], $this->uri->segment(3));
$data['result'] = $this->blog_mysql->getAll($config['per_page'], $this->uri->segment(3));

echo print_r($this->session->all_userdata());

$this->load->view('blog/pages', $data);

}


Model



Code:
function getAll($num1, $num2)
{

$id = $this->session->userdata('user_id');
$this->db->where('user_id', $id);
$this->db->order_by('date desc');
$query = $this->db->get('blog',$num1, $num2);
  
if ($query->num_rows() > 0)
{
     foreach ($query->result() as $row)
     {

  $data[] = $row;
   }
  
}
   return $data;
}


Messages In This Thread
Problem with Pagination Killing session userdata - by El Forum - 05-20-2012, 12:34 PM
Problem with Pagination Killing session userdata - by El Forum - 05-20-2012, 02:23 PM
Problem with Pagination Killing session userdata - by El Forum - 05-21-2012, 06:24 AM
Problem with Pagination Killing session userdata - by El Forum - 05-21-2012, 07:41 AM
Problem with Pagination Killing session userdata - by El Forum - 05-21-2012, 09:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB