1
+ − 1
<?
+ − 2
8
+ − 3
require_once ( "MDB2.php" );
1
+ − 4
+ − 5
function dbError ( $msg )
+ − 6
{
+ − 7
// General function for printing critical errors.
+ − 8
include_once ( "header.inc.php" );
+ − 9
?>
13
+ − 10
<h2> <? echo _ ( 'Oops! An error occured!' ); ?> </h2>
+ − 11
<p class= "error" > <? echo $msg -> getDebugInfo (); ?> </p>
+ − 12
<?
+ − 13
include_once ( "footer.inc.php" );
1
+ − 14
die ();
+ − 15
}
+ − 16
+ − 17
PEAR :: setErrorHandling ( PEAR_ERROR_CALLBACK , 'dbError' );
+ − 18
+ − 19
$dsn = " $dbdsntype :// $dbuser : $dbpass @ $dbhost / $dbdatabase " ;
8
+ − 20
$db = MDB2 :: connect ( $dsn );
1
+ − 21
8
+ − 22
if ( MDB2 :: isError ( $db ))
1
+ − 23
{
+ − 24
// Error handling should be put.
+ − 25
error ( MYSQL_ERROR_FATAL , $db -> getMessage ());
+ − 26
}
+ − 27
+ − 28
// Do an ASSOC fetch. Gives us the ability to use ["id"] fields.
8
+ − 29
$db -> setFetchMode ( MDB2_FETCHMODE_ASSOC );
1
+ − 30
+ − 31
/* erase info */
+ − 32
$mysql_pass = $dsn = '' ;
+ − 33
+ − 34
+ − 35
?>