Enable PHP ADODB handling
Snippet
Written with a loving hand by kitt some time around 00:15 on 16 August 2009
By default, PHP's ADODB library will not give full error messages on pconnect, or route to an error handler. The error handler has to be enabled.
<?php // pass any error messages triggered to error handler error_reporting(E_ALL); include('adodb-errorhandler.inc.php'); include('adodb.inc.php'); // suppress error messages for the connection ini_set("display_errors", "0"); try { $mydb = &ADONewConnection('mysql'); $mydb->PConnect('dbhost','dbuser','dbpass','dbname'); } catch (exception $e) { // unable to connect to the DB (usually too many connections), redirect away header('Location: /error.html'); exit(); }
Add new comment