5 * Functions for the database
18 // PEAR must be installed
19 require_once('DB.php');
23 * Logs into database and returns database handle
31 * username for database
33 * password for database
39 * variable to hold the returned database handle
41 function logon($engine,$dbfile,$username,$password,$host,$name) {
45 // datasource mostly to support sqlite: dbengine://dbfile?mode=xxxx
46 $dsn = $engine . '://' . $dbfile . '?mode=0666';
49 // datasource in in this style: dbengine://username:password@host/database
50 $datasource = $engine . '://' . $username . ':' . $password . '@' . $host . '/' . $name;
56 'portability' => DB_PORTABILITY_LOWERCASE|DB_PORTABILITY_RTRIM|DB_PORTABILITY_DELETE_COUNT|DB_PORTABILITY_NUMROWS|DB_PORTABILITY_ERRORS|DB_PORTABILITY_NULL_TO_EMPTY,
60 $dbh = DB::connect($datasource,$options);
62 // if connection failed show error
63 if(DB::isError($dbh)) {
64 $_SESSION['ari_error'] .= $dbh->getMessage() . "<br><br>";