PHP
  Home arrow PHP arrow Code 10x More Efficiently Using Data Acces...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Download TestComplete 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Code 10x More Efficiently Using Data Access Objects: Part 1
By: Oto Hlincik
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 44
    2003-10-11

    Table of Contents:
  • Code 10x More Efficiently Using Data Access Objects: Part 1
  • The Old Way
  • Code Samples, The Old Way
  • Database DAO to the Rescue
  • Convenience and Performance
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Application developers can seamlessly integrate the Advantage Database install with their application install. Learn the best practices used when setting up silent installs with this seminar.

    Code 10x More Efficiently Using Data Access Objects: Part 1
    (Page 1 of 6 )

    Learn how to efficiently access database information using Data Access Objects (DAO) with PHP. Oto shows us how easy database manipulation can be, as well as how much time can be saved.

    Everyone knows that today an effective website cannot do without dynamic content. Usually this content comes from some kind of database. PHP provides great built-in functions that allow the developer or programmer to access all of the most popular (and many of the not so popular) databases. There is not much work involved in connecting to a database, sending a SQL query over, receiving some kind of data back and then iterating over the returned records and … doing something interesting with it. Sounds pretty straight forward, doesn't it? I guess it does until you need to do the same thing over and over on just about every page, sometimes more than once on a single page, and it becomes even more interesting if you need to access different databases within one script.

    One thing that signifies every good programmer is the desire to make coding life easier for him or herself. The first step is to create a reusable chunk of code that can be copied and pasted over and over, with changing parts of it as needed (a technique known as "code reusability). The second step would be creating a function that encapsulates some of this functionality, but ultimately is still not flexible enough to provide the desired reusability.

    There must be a better way. And there is! Why not use the Object Oriented Programming capabilities of PHP and encapsulate the functionality that every developer uses about 95% of the time? Let's use a Data Access Object (DAO) for our communication with a database. (For experienced programmers: Don't worry, I am not talking about database abstraction such as PEAR::DB, so read on…)

    More PHP Articles
    More By Oto Hlincik


     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway