...

View Full Version : Database class / PHP database extension bridge.



marek_mar
10-23-2006, 04:57 PM
This is a really simple to use database class that lets you use many databases using the same functions. It is very easy to use and should help with common tasks and debugging.
Connecting is as easy as:


<?php
require 'internal_dbal/dbal.class.php';
try
{
$db = internal_dbal::connect('mysql', 'server', 'database', 'user', 'password');
}
catch(idbal_exception $e)
{
die($e->getMessage());
}
?>

The first argument is your database of choice. The class will automatically use the best extension available for the database you select.
You can connect by yourself and use internal_dbal::start() to use the class if you want to make a specific choice.
The class has 12 methods of, most of which you will know what they do instantly.
The exact usage is shown in dbal.php included in the zip file.
It shows every nice feature the class has to offer.
You do not need all the files in the zip file. I would actually suggest to remove those you don't use as that will save you disk space.
I recommend you to download GeShi (http://qbnz.com/highlighter/) for SQL and PHP highlighting when you're debugging.
By default the debug functionality is disabled - for security reasons. To enable it find these 3 constants:


const DEBUG = false;
const SPECIAL_BACKTRACE = false;
const SPECIAL_DEBUG = false;

and set them to true.

This class was designed to allow my classes more compatibility for databases as well as database extensions (MySQL can be accessed through mysql, mysqli and PDO). It is required to use them.

If you have any questions I'll be happy to anwser them.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum