PHP
  Home arrow PHP arrow Using PDO Objects in PHP 5
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
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

Using PDO Objects in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 19
    2007-05-29

    Table of Contents:
  • Using PDO Objects in PHP 5
  • Using the PDO extension
  • Running queries against a specific database
  • Finding insertion IDs for database rows

  • 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


    Using PDO Objects in PHP 5


    (Page 1 of 4 )

    The PDO library is a powerful addition to PHP. It shines when you need to build applications capable of talking to different database systems. It also has other very useful capabilities. This article, the first in a three-part series, will introduce you to this versatile library.

    Introduction

    PHP developers who used to work with different relational database systems have had two choices when it came to building their web applications. They either had to include a third-party library that allowed transparent handling of the interaction with RDBMSes, or, in the worse case, they had to create their own database abstraction layers, which was a time-consuming process.

    In the first case, picking up a pre-built package that provided PHP programmers with a decent level of abstraction for using diverse database servers was reduced to choosing between a certain number of well-trusted libraries. These include the robust PEAR::DB, or the excellent ADODb database abstraction software, to name the most popular libraries.

    However, in many cases PHP applications are conceived from the very beginning to interact only with MySQL, which facilitates their development enormously. In this situation the application does not need to work with multiple database systems. Consequently, in this case using a simple MySQL-related package can satisfy quickly all the eventual database requirements.

    Nonetheless, there are times when a certain web application needs to interact with more than one database server. This implies having to build more complex classes (if you're using an object-oriented approach) or picking up a third-party library that may be capable of suiting these specific database requirements.

    As you may have heard, for those PHP developers that frequently need to work with different database systems, I must say that good news are just around the corner. With the release of PHP 5.1 (and subsequent versions of the language, by the way), a brand new database abstraction layer has been included.

    Yes, you guessed right! In this case I'm talking about the powerful PDO library. PDO is short for PHP Data Objects. The library consists of a versatile package that makes it easy to talk to popular database systems, such as MySQL, Oracle, MS SQL, and so on using a fully oriented object-based notation. Of course, the benefits of using this library don't end here; it also offers the possibility of processing result sets in all sorts of clever ways, handling stored procedures, performing transactions, using markers in queries, and so forth.

    As you may have seen at first glance, the PDO extension looks really useful in certain situations. In this three-part series, I'm going to introduce its most important features, by accompanying the corresponding theoretical concepts with numerous hands-on examples, in this way facilitating the respective learning curve.

    Now, are you ready to dive deeper into the powerful PDO library? Okay, let's begin now!

    More PHP Articles
    More By Alejandro Gervasio


       · This first article of the series introduces the basics on working with the PDO (PHP...
       · You describe PDO as a db abstraction layer in the last line of paragraph 5 after...
       · Thanks you for commenting on my PHP tutorial. Now, with reference to your question...
       · PDO is data-access abstraction (not database abstraction). The primary goal is to...
       · Thank you for posting your opinions here. You’re correct, providing that some...
       · So then maybe I am missing the value in using this ext.Why would you want to use...
       · Thank you again for commenting on my PHP article. Well, while using the PEAR:MDB2 is...
       · Well, thank you for your tutorial,however I think you missed the biggest added...
       · Thank you for commenting on my PHP article. However I'm afraid you're mistaken since...
     

       

    PHP ARTICLES

    - Using Aliases and the Autoload Function with...
    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Sub Classing Exceptions in PHP 5
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT