One of the nicest things about Perl - the DBI module - finallymakes an appearance in PHP. Take a look at the PEAR database abstractionlayer, by far one of the coolest PHP widgets out there.
In case your short-term memory is on the fritz, here's a brief summary of everything discussed so far:
A database abstraction layer provides a database-independent interface to developers working on different databases. Perl has one, and now PHP has one too, courtesy of PEAR. Though an abstraction layer can take a little getting used to, it offers tremendous benefits in the long run, especially if you expect platform or database changes during the development cycle. Using an abstraction layer can significantly reduce the amount of time you spend porting your code over from one database to another.
The PEAR abstraction layer currently includes support for a number of different database types, including MySQL, PostgreSQL, Oracle, Sybase and ODBC. In addition to frequently-used methods for executing queries and fetching resultsets, the PEAR abstraction layer also supports pre-prepared queries, transactions and customized error handling. A number of miscellaneous utility functions are also included to assist in query execution and data retrieval.
That just about concludes this little tour of PHP's database abstraction layer. I hope you enjoyed it and found it useful, and that it demonstrated the flexibility and power of one of my favourite PHP widgets. Until next time...ciao!
Note: All examples in this article have been tested on Linux/i386 with Apache 1.3.12 and PHP 4.1.0. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!