Tech Arise

Simple Pagination Using CodeIgniter and MySQL

Pagination is one of the most frequently used features for web applications. So We have a 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.
Before started to implement the Simple Pagination Using CodeIgniter and MySQL, look files structure:
Step 1: Create the database and Table
For this tutorial, you need a MySQL database with the following table:
Step 2: Initialization CodeIgniter pagination library
Initialization CodeIgniter pagination library (file name: pagination.php) “application/config/” folder.
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 a view(header)
Create a view file named header.php inside “application/views/templates” folder.
This view contains the header section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header section.
Step 6: Create a view(footer)
Create a view file named footer.php inside “application/views/templates” folder.
This view contains the footer section of the webpage.
Step 7: Create views
Create a views file named index.php inside “application/views/employee” folder.
Exit mobile version