Home arrow Zend arrow Build Database Interfaces

Build Database Interfaces

This article is about using and building Database Interfaces (DB interfaces). DB interfaces make application development faster and easier. This is accomplished by relocating scattered DML (Insert, Update, Delete) statements into a single shared tool, the Class. A Class encapsulates data post processing, integrity, and security into a single tool that can be accessed throughout the application.

  1. Build Database Interfaces
  2. Replacement Example
  3. Lessen the Impact
  4. Autonomous
By: Zend
Rating: starstarstarstarstar / 10
January 04, 2004

print this article



Over the past couple of years many tools have been developed to address the limitations of PHP when building large database applications. These tools can be divided into two categories:

  • Database Abstraction
  • HTML Generation

DB Interfaces are a new category of tools that sits between the application logic and the database logic.

The Big Picture
PHP was designed to be a “quick and simple” tool for making web pages dynamic. However, it does not scale well to building full-blown applications without a lot of planning and design. While PHP can make building a solitary web page “quick and simple”, applications often become ‘quick and dirty’.

When an application reaches a certain size, the rules change about how it should be built. The design rules for a single HTML page with some embedded PHP are much different from a 15,000 line PHP application. As the complexity of an application grows, manageability decreases. Although PHP is designed to be embedded into HTML, this ability becomes inhibiting as the application becomes more complex.

Embedded SQL suffers from the same limitations as imbedded PHP. As application size grows, maintainability becomes more difficult.

The Solution
Separating the three common components of PHP applications is the best solution. The common components are:

  • A database
  • The PHP logic
  • The layout (in HTML)
Tools such as ADODB and Smarty are commonly used to aid this separation. ADODB makes it easier for applications to support different databases systems. Smarty separates the display logic and HTML from the application logic.

A more manageable solution is using a Database interface to communicate with the database. DB Interfaces separate the database logic from the application logic. By using a DB interface, DML operations are separate from the logic flow, which makes code easier to work with.

It is best to use a database interface to handle the DML operations on a table. By using a database interface to provide a single point of data modification, a finer level of security and data integrity can be achieved.

>>> More Zend Articles          >>> More By Zend

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Taking the Zend Certified PHP Engineer Exam:...
- Quick Introduction to PHP 5
- PHP SOAP Extension
- Improving Performance
- PDFs with PHP part 2
- PDFs with PHP part 1
- PHP at Lycos
- Build Database Interfaces

Developer Shed Affiliates


Dev Shed Tutorial Topics: