Sunday, April 29, 2018
Use Codeigniter Pagination In Your Projects
Use Codeigniter Pagination In Your Projects
Use Codeigniter Pagination In Your Projects
CodeIgniter application usually have at least one database. In an average project, the database produces a lot of queries that need to be presented. The problem is that the display of the results could be messy. This is where pagination in CodeIgniter comes to the rescue.
In this tutorial, I will demonstrate how to use this technique in your CodeIgniter projects. I will start with the Model, then Controller and finally with the View.
The Model
The model for the demo application carries out two important tasks: It provides a count of the records in the Departments table, and retrieve the list of departments from the table.
The path of the model is models/departments.php. Here is the code for the model:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | <?php class Departments extends CI_Model { public function __construct() { parent::__constructlink download
Related Post
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.