Pagination is one of the most frequently used features for web applications. So We have share in this tutorial, how we can implement CodeIgniter pagination and enhance it further as per our need. Pagination is the process of dividing a document into discrete pages.

Step 1: Create the database and Table- DB Name: pagination_DB, Table Name:employee
For this tutorial, you need a MySQL database with the following table:

//Table structure for table employee

Step 2: Initialization CodeIgniter pagination library
Initialization CodeIgniter pagination library (file name: pagination.php) “application/config/” folder.

per_page: Refers to the number of how many entries will be shown on each page.
base_url: Refers to the paginated url base.
total_rows: Total numer of entries in database.
use_page_numbers: Refers whether we want to use page number(1,2,3..) in the url or entry id(1,10, 20…) on uri segment.

Step 3: Create Model
Create a model file named Employee_model.php inside “application/models” folder.

Load “pagination” class in controller.

Step 4: Create controllers
Create a controllers file named Employee.php inside “application/controllers” folder.

Step 5: Create views
Create a views file named index.php inside “application/views/employee” folder.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">