inc/database.inc.php
author rejo
Mon, 02 Jul 2007 23:01:18 +0000
changeset 36 4ec5ab29f634
parent 13 2ff220cfde13
child 47 ae140472d97c
permissions -rwxr-xr-x
[feladat @ 83] Bugfix: the list_zones.php wasn't listing zones correctly if a zone didn't have an owner. Bugfix: the list_supermasters.php never listed more then one supermaster, even if there were more. Both bugs were reported by Jasper van Erven Dorens.

<?

require_once("MDB2.php");

function dbError($msg)
{
        // General function for printing critical errors.
        include_once("header.inc.php");
        ?>
	<h2><? echo _('Oops! An error occured!'); ?></h2>
	<p class="error"><? echo $msg->getDebugInfo(); ?></p>
	<?        
	include_once("footer.inc.php");
        die();
}

PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'dbError');

$dsn = "$dbdsntype://$dbuser:$dbpass@$dbhost/$dbdatabase";
$db = MDB2::connect($dsn);

if (MDB2::isError($db))
{
	// Error handling should be put.
        error(MYSQL_ERROR_FATAL, $db->getMessage());
}

// Do an ASSOC fetch. Gives us the ability to use ["id"] fields.
$db->setFetchMode(MDB2_FETCHMODE_ASSOC);

/* erase info */
$mysql_pass = $dsn = '';


?>