/** * create database object * * TODO: don't even think about doing connection caching here... pear db|mdb2 does thah for you * * @param String $name db name, key from $CONF['db'] array * @return PearDB object on success * @throws Exception if object creation failed */ function dbConnect($name = 'default') { global $CONF; if (!isset($CONF['db'][$name])) { throw new Exception("db error - no such record '{$name}'"); } $db = dbConnectDSN($CONF['db'][$name], $options); return $db; }
<?php require_once 'error_handler.inc.php'; require_once 'exception_handler.inc.php'; require_once 'functions.inc.php'; require_once 'database.inc.php'; $DB = dbConnectDSN('mysql://*****:*****@localhost/rammstein');