Home arrow PHP arrow Previous or Next? Paginating Records with PHP - Part 3

Previous or Next? Paginating Records with PHP - Part 3

In part three of our series about paginating records with PHP, we will learn how to make our application work with a relational database system such as MySQL. We will develop a tight, compact PHP class, capable of performing the most common paging tasks efficiently.

TABLE OF CONTENTS:
  1. Previous or Next? Paginating Records with PHP - Part 3
  2. Object-oriented paging: anatomy of the "Pager" class
  3. Controlling the look of database records: defining a template file
  4. Going deeper: a detailed coverage at the "displayRecords()" method
  5. The final round: completing the "displayRecords()" method
By: Alejandro Gervasio
Rating: starstarstarstarstar / 16
May 10, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Welcome to part three of the series "Previous or Next? Paginating Records with PHP." I hope that you've had a good time reading the previous articles, where we strongly focused our attention on implementing several approaches to paginate data in websites, using PHP's excellent capabilities. So far, we've developed a couple of methods for displaying chunks of data, appending the proper paging links, and providing an easy way to navigate across pages.

In the first case, we explored a procedural approach for dealing with the topic, defining a function to paginate data coming from a simple text file. This approach is suitable for small applications. Analogously, in the second case, we utilized a plain text file as a data source, but this time we built up a paging PHP class to generate the visual data output and the paging links. However, our newly developed "Pager" class presents some issues that need to be properly addressed.

Since the Web is now driven almost entirely by databases, we should be able to work with a relational database system such as MySQL to paginate result sets, and have the possibility of applying an effective visual format to retrieved records. To meet real world needs, it's highly imperative to develop a tight, compact PHP class, capable of performing the most common paging tasks efficiently, with minor hassles at most.  So, let's jump straight into the class code and create this new toy for our developer's toolbox.



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: