Pagination not working on my application - CodeIgniter

RoboPHP

I have been able to develop a pagination for my page which contains about 25000 records. The page paginates in 100's but for now, when i click on the pagination link to move to the next page, it leads me to the first page again. But the URI on my browser shows the per page number like customers/100 . What could i be doing wrong below

Controller

    $config['base_url'] = base_url() . 'customers/index/';
    $config["total_rows"] = $customers
    $config["per_page"] = 100;
    $config['num_links'] = 10;
    $config["uri_segment"] = 3;

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

    $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;

    $data['items'] = $this->customer->get_customer_all($config["per_page"]);

Model

public function get_customer_all($limit = null) {
        $this->db->select('*');
        $this->db->from('courses');           

        if($limit!=''){
            $this->db->limit($limit);
         }
        $query  = $this->db->get();

        return ($query) ? $query->result() : false;
    }
Slava

Why do you not use $page variable? For getting data partially you need both limit and offset. limit for count of customers per page and offset for understanding what page you are on.

So try to change you request to model like this:

$data['items'] = $this->customer->get_customer_all($config["per_page"], $page);

And update model like this (with some changes):

public function get_customer_all($limit = 0, $offset = 0) {
    return $this->db->select('*')->
                      from('courses')->
                      limit($limit)->
                      offset($offset)->
                      get()->
                      result_array();
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Pagination not working on Codeigniter 3

From Dev

Pagination is not working properly in Codeigniter

From Dev

Codeigniter - Pagination not working correctly

From Dev

Pagination codeigniter not working

From Dev

Codeigniter pagination is not working

From Dev

Codeigniter Pagination Not working Properly

From Dev

My pagination is not working

From Dev

Codeigniter 3 pagination with htaccess not working

From Dev

Bindparam is not working for my pagination script

From Dev

My pagination in Category pages is not working

From Dev

Codeigniter ajax pagination search results not working

From Dev

Pagination not working in codeigniter getting 404 page not found

From Dev

Why are pagination links not working for me in CodeIgniter?

From Dev

pagination in codeigniter and passing values to a controller function but pagination not working

From Dev

My image upload option is not working in my codeigniter application.How can i get solve this?

From Dev

(React) Margin auto not working for my pagination bar

From Dev

Pagination implementation not working on my React app

From Dev

Why isn't my pagination code working?

From Dev

my pagination seems not to be working - DRF problem

From Dev

Dependency not working with my application

From Dev

TabPane is not working on my Application

From Dev

Codeigniter Pagination

From Dev

codeigniter pagination: links are working but the records are repeated on other pages

From Dev

Codeigniter application: how can I display pagination as JSON?

From Dev

Codeigniter and AngularJS bug: pagination does not work when the application is not in the root directory

From Dev

localStorage is working wrong in my application

From Dev

CopyAsync method not working in my application

From Dev

why my sessiosn are not working in codeigniter 3?

From Dev

My controller for register and login is not working (Codeigniter)

Related Related

  1. 1

    Pagination not working on Codeigniter 3

  2. 2

    Pagination is not working properly in Codeigniter

  3. 3

    Codeigniter - Pagination not working correctly

  4. 4

    Pagination codeigniter not working

  5. 5

    Codeigniter pagination is not working

  6. 6

    Codeigniter Pagination Not working Properly

  7. 7

    My pagination is not working

  8. 8

    Codeigniter 3 pagination with htaccess not working

  9. 9

    Bindparam is not working for my pagination script

  10. 10

    My pagination in Category pages is not working

  11. 11

    Codeigniter ajax pagination search results not working

  12. 12

    Pagination not working in codeigniter getting 404 page not found

  13. 13

    Why are pagination links not working for me in CodeIgniter?

  14. 14

    pagination in codeigniter and passing values to a controller function but pagination not working

  15. 15

    My image upload option is not working in my codeigniter application.How can i get solve this?

  16. 16

    (React) Margin auto not working for my pagination bar

  17. 17

    Pagination implementation not working on my React app

  18. 18

    Why isn't my pagination code working?

  19. 19

    my pagination seems not to be working - DRF problem

  20. 20

    Dependency not working with my application

  21. 21

    TabPane is not working on my Application

  22. 22

    Codeigniter Pagination

  23. 23

    codeigniter pagination: links are working but the records are repeated on other pages

  24. 24

    Codeigniter application: how can I display pagination as JSON?

  25. 25

    Codeigniter and AngularJS bug: pagination does not work when the application is not in the root directory

  26. 26

    localStorage is working wrong in my application

  27. 27

    CopyAsync method not working in my application

  28. 28

    why my sessiosn are not working in codeigniter 3?

  29. 29

    My controller for register and login is not working (Codeigniter)

HotTag

Archive