Using What You Know

Pursuing this line of thought, you need to:

  • Filter and order records

  • Know the total number of records

  • Be able to extract sequential subsets of the total

In the context of database classes, the description of the requirements immediately suggests the use of the SQL ORDER BY, WHERE, and LIMIT clauses to order, filter, and extract subsets respectively. You had to create this kind of functionality for the DirectoryItems class, but why recreate what's already available in SQL?

Just as PHP's built-in image manipulation functions helped create the ThumbnailImage class, look also for assistance from the existing MySQL-related functions. If you've used these functions before, you'll immediately know which ones are the most important ...

Get Object-Oriented PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.