One handy class that Joe always keeps in his PHP toolbox is a custom MySQL recordset paging class, which he developed about 5 months ago. In this article Joe describes how he created the MySQL recordset paging class with PHP and also shows us how to use it with three cool examples!
Building A Dynamic MySQL Paging Class With PHP (Page 1 of 6 )
As PHP developers, we can develop pretty much anything that we can think of: database driven sites, complete GUI applications with PHP-GTK, XML based representations of our data, chat applications, search engines, etc.
To create applications like those mentioned above we need a diverse range of tools in our toolkit. By tools, I mean pieces of code or programs that help us develop these applications quicker and easier, such as classes, functions, IDE's and the like. One handy class that I always keep in my PHP toolbox is my custom MySQL recorset paging class, which I developed about 5 months ago. Time and time again I've found myself using this class to develop web sites for my clients, and today I'm going to show you how I created the class.
In this article we're going to work through a step-by-step format to create a highly generic, customizable MySQL recordset paging class with PHP. The class accepts custom queries and options such as the layout of the results and the number of results per page can be changed easily.
To work with the class we're about to create, you should have PHP and MySQL installed on either a Windows or Linux PC. You should also have intermediate knowledge of PHP, regular expressions and MySQL.