A database abstraction layer (DBAL) is a couple of functions or a class which deals with every aspects of database handling.
First of all you have a function to connect and to disconnect to/from the database. You also have some functions to submit a query, and to get the results and finally you need to have some error-handling functions too.
Of course you do not replace the php-functions, you just connect them to get a better performance when you need to develop your code, validate the data, etc.
If you use a really flexible DBAL, then you do not need to change every line of your code if you switch from one database type to the other.
Most users should not be writing their own DBAL, since there are several ready-to-use open-source DBALs available. One of the benefits of a DBAL is to make code more reusable, and writing your own DBAL (unless it achieves wide acceptance in the PHP community) is counterproductive. The most common one is the PEAR:DB package which is already installed on the majority of web servers.
You can find some less sophisticated DBALs in the source files of some well written open-source CMS sites also.
Manage research, learning and skills at defaultlogic.com. Create an account using LinkedIn to manage and organize your omni-channel knowledge. defaultlogic.com is like a shopping cart for information -- helping you to save, discuss and share.