Home arrow PHP arrow Running Conditional Select Statements with the Active Record Pattern

Running Conditional Select Statements with the Active Record Pattern

If youíre a PHP programmer who wants to learn how to implement the active record pattern within a MySQL abstraction class to make your database-driven applications more robust and maintainable, then look no further. Welcome to the third part of a series focusing on the active record pattern. Made up of seven articles, this series explains how to take advantage of the functionality provided by this popular design pattern to build an extensible MySQL-accessing class. This class will allow you to perform several queries without explicitly writing any SQL statements.

TABLE OF CONTENTS:
  1. Running Conditional Select Statements with the Active Record Pattern
  2. Review: performing CRUD operations through the active record approach
  3. Performing conditional SELECTS through the active record pattern
  4. Running conditional SELECTS using the sample MySQL class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
March 17, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Now that youíre aware of the main goal of this group of tutorials, itís time to review the topics we covered in the last article. In that part, I walked you through the development of a basic MySQL abstraction class, which was capable of fetching, inserting, updating and deleting database records (also known as CRUD operations) by means of the active record approach.

Basically, this implied that the MySQL-accessing class was provided with the capability for running all of these queries without the need to manually code the corresponding SQL clauses, a feature that helped to abstract SQL code.

However, as you may have guessed, thereís plenty of room for enhancing the functionality of this simple class. With that idea in mind, in this third chapter of the series Iím going to show you how to add a new method to the class. It will be charged with executing conditional SELECT statements via a modified version of the active record pattern.

Now, with the preliminaries out of our way, itís time to dig deeper into this interesting topic. Letís get going!



 
 
>>> 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: