Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Using PHP Objects to Access Your Database Tables (Part 2)

By Tony Marston
2005-04-07


Summary

I hope that this article has shown you that even though PHP4 does not have all the OO capabilities to satisfy the purists it has more than enough to allow you, the developer, to create large amounts of reusable code, which is one of the big benefits that OOP is supposed to provide. With PHP I have managed to achieve the following:

Create a base class which can handle all the basic read/write/update/delete functions for any database table.
Incorporate the usefulness of a data dictionary/repository into the class so that common tasks can be performed by standard code without the need for duplicated custom code.

• This base class contains all the necessary code to perform standard field validation when performing an insert or an update.
• This base class contains all the necessary code to validate changes in any candidate keys.
• This base class contains all the necessary code to handle the delete constraints in any relationship.
• This base class is used to create extended classes for each individual table in your database.
• Each of these extended classes will automatically inherit all the standard code from the parent (base) class which means that custom code is only required to deal with custom circumstances.

Tutorial Pages:
» Intended Audience
» Extending the MySQL SELECT statement
» Adding the features of a Data Dictionary/Repository
» Using the Data Dictionary/Repository
» Changing Candidate Keys
» Deleting Rows
» Custom Processing
» Virtual Database Tables
» Summary


 | Bookmark
Related Tutorials:
» Zend Framework Tutorial
» Port Scanning and Service Status Checking in PHP
» Web Database Access from Desktop Applications
» CubeCart 3.0 Installation and Configuration
» PHP Site Search Made Easy
» Installing and Configuring Drupal 6.1

Ask A Question
characters left.