PHP
  Home arrow PHP arrow Page 2 - 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  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
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 / 45
    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
     
     
    ADVERTISEMENT


    Code 10x More Efficiently Using Data Access Objects: Part 1 - The Old Way


    (Page 2 of 6 )

    As mentioned earlier, PHP provides great built-in functions that allow the developer to connect to a database and retrieve some data. (If you are an experienced PHP programmer and do not feel like getting bored with the "same old", skip ahead to the section titled "Database DAO to the Rescue"). 

    In what ways do we usually need the data returned from a database, and in what format do we like to have the data returned? In my years of development I have realized that in overwhelming majority of cases I need to have my data returned in three ways: as a single value, as one record, and as many records.

    Let's see how we would go about getting a value, a record, and a recordset returned from the database the "old way." PHP is most frequently coupled with the MySQL database software, so let's use it for our example. I have a contact database with a "Contacts" table full of, you guessed it, contacts. The database is accessible on the "localhost", the user is "user", the password is "password", and the table structure looks something like this:

    Table Contacts

    FieldType Key Null? 
    id int(11) PRI  
    first_namevarchar(64)  
    last_namevarchar(64)  
    phonevarchar(20) YES 
    emailvarchar(64) YES

    More PHP Articles
    More By Oto Hlincik


       · Could you please verify that link. It seems the domain isn't active (anymore)? Would...
     

    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 3 hosted by Hostway