phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


PDO: Introduction PHP Data Object

Tag: PHP Data Objects, PDO, extension, PHP extension   Category: PHP Database
post: 18 Apr 2008 read: 804


PHP Data Objects (PDO) Step By Step Tutorial - Part 1: PDO is a PHP5 extension that defines a lightweight DBMs connection abstraction library. Mmm, we ever talk about DMB connection abstraction library (sometimes called data access abstraction library). Yup, we talk data access abstraction library using ADOdb. PHP ADOdb special for PHP4 and PDO only work for PHP5. PDO have function like ADOdb with more benefits.

What is data access abstraction library? As we know, PHP support several major database, such as mySQL, SQLite, msSQL, and so on. Each connection to those database have unique code. For example, we want to connect to mysql, we wil write:


mysql_connect($host, $user, $password);

If we want to connect to SQLite:


sqlite_open($db, 066);

for postgreSQL:


pg_connect("host=$host dbname=$db user=$user password=$password");

What that mean? For example, we have built application base on mysql. When our customer need move to SQLite, we must rebuild our application. We must rewrite many line code. How if our code consist 1,000,000 lines? Nightmare!

Data access abstraction layer will bridge the different. We just write once, and run in every where (like java he he he....)

Next, we talk how to activate PDO extension.




| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting