Usage with adoDB lite
Previous  Next

Usage of adoDB lite is suggested because it will give the programmer the freedom to change to any database system without rewriting the code, without considering advantages of knowing a single plain API instead of all the different flavours.

adoDB lite version 1.40 and above comes with the Gladius DB driver; if you have an older version, follow the below steps.

Manual installation

1.   locate your adoDB lite drivers folder, usually adodb_lite/adodbSQL_drivers
2.   check for the presence of a gladius folder, create such folder taking care of the lowercase name that must be gladius
3.   move the gladius_*.inc.php files into it
From here on, you can use Gladius as any other adoDB database system, taking care of including Gladius itself before instancing the ADO connection.

Example usage

See the below example:

<?php
            // setup the databases folder
            global $GLADIUS_DB_ROOT;
            $GLADIUS_DB_ROOT = 'yourdirectory/databases/';

            // include Gladius
            require_once 'yourdirectory/gladius/gladius.php';

            // include adoDB lite
            require_once 'yourdirectory/adodb_lite/adodb.inc.php';
            
            // creates the adoDB connection using Gladius
            $db = ADONewConnection('gladius');

            // connect to the database, the first 3 parameters are ignored
            $connected = $db->Connect('', '', '', 'databasename');
            
            // print the result
            print_r($connected);
?>