Welcome Guest, Not a member yet? Register   Sign In
Problem with Pagination Class and LIMIT, OFFSET in db query
#1

[eluser]Unknown[/eluser]
Hello all. I have a problem with Pagination class. That`s my model and controller code:
Code:
public function get_items($id = FALSE, $offset){
  if($id == FALSE){
   $query = $this->db->get('Item', 2, $offset);
   $items = $query->result_array();
   return $items;
  }
Code:
public function index($number = 0){
  $data['items'] = $this->item_model->get_items(FALSE, $number);
  $rows = count($data['items']);
  
  $this->load->library('pagination');
  $config['base_url'] = 'http://localhost:8888/item/index';
  $config['total_rows'] = $rows;
  $config['per_page'] = 2;
  $this->pagination->initialize($config);

  echo $this->pagination->create_links();
  $this->load->view('item/index', $data);
}

Problem is, that create_links() function returns blank string! And after some experiments i found out that deleting of "limit, offset" part of my database query makes everything to work perfect!
Can anyone tell me how to fix it? Found nothing in internet about such problem





Theme © iAndrew 2016 - Forum software by © MyBB