Home arrow PHP arrow Utilizing the LIMIT Clause with the Active Record Pattern

Utilizing the LIMIT Clause with the Active Record Pattern

Welcome to the fifth installment of a series focused on using the active record pattern with PHP. Made up of seven episodes, this series walks you through the progressive development of a MySQL abstraction class that utilizes the active record approach to perform CRUD (Create, Remove, Update, Delete) database operations and SELECT queries, without having to explicitly code any SQL statements.

TABLE OF CONTENTS:
  1. Utilizing the LIMIT Clause with the Active Record Pattern
  2. Review: fetching database records using the LIKE clause
  3. Enhancing the functionality of the MySQL class with the LIMIT clause
  4. Example: fetching database rows with the LIMIT clause
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
March 31, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Now that you've been introduced to the main subject of this group of articles, it's time to recall the topics that were covered in the last one. In that specific tutorial I explained how to build a basic MySQL abstraction class, which was capable of performing the CRUD tasks mentioned before, in addition to fetching database records using the LIKE clause.

Of course, the structure of this class is rather primitive and definitely wasn't suited for use in production environments. Despite this disadvantage, it came in useful for demonstrating how it can be utilized for accessing MySQL databases by means of the active record approach.

However, it's fair to mention that the functionality of the class can be enhanced. In its current version, it'll be able to accomplish only a few basic database operations tasks. Therefore, this fifth article of the series will be focused on enabling the class to fetch database rows by using the LIMIT clause.

By following the same approach demonstrated in preceding articles, this brand new capacity will be implemented through the active record pattern, in this manner extending its utilization within a MySQL abstraction class even more.

Now, it's time to get our hands dirty with a few functional PHP code samples. Let's jump in!



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

blog comments powered by Disqus
   

PHP ARTICLES

- 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...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap

Dev Shed Tutorial Topics: