Paginating Database Records with the jQuery Quick Pagination Plug-in
In this fourth part of a five-part series, I start developing a basic database-driven web application that displays a list of fictional users fetched from a MySQL table. The application is capable of generating a couple of static sections of a web page, including the typical header and footer sections.
Paginating Database Records with the jQuery Quick Pagination Plug-in - Building a sample MySQL table (Page 2 of 4 )
To demonstrate how to use the Quick Pagination jQuery plug-in for paginating a set of database records, it’s necessary to define the database and fill it with some data. Well, to do this I’m going to use a MySQL table, which will house information about a group of hypothetical users, including their first and last names and their email addresses.
With that being said, the structure of this MySQL table will be as follows:
DROP TABLE IF EXISTS `test`.`users`;
CREATE TABLE `test`.`users` (
`id` INT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
`fname` VARCHAR(100) NOT NULL,
`lname` VARCHAR(100) NOT NULL,
`email` VARCHAR(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
To be frank, the way I've defined the “users” table isn't especially interesting, so let's move on and look at the image below, which shows the table already populated with data about some users:
So far, nothing unexpected is happening here, right? Having already created a MySQL table that stores a list of users, the next logical step is to define a simple PHP class that allows us to fetch those users from the table via an intuitive, uncluttered interface.
The definition of this class will be shown in the next section. Thus, to learn more about it, click on the link below and keep reading, please.