getting database connection to fail gracefully

From: Date: Wed, 22 Jan 2003 11:11:38 +0000
Subject: getting database connection to fail gracefully
Groups: php.general 
Request: Send a blank email to php-general+get-132571@lists.php.net to get a copy of this message
Is there a way to get a database query to fail gracefully, so that rather than calling Die(), it can work around the problem? In other words, to do something like: if (mssql_connect($sDBhostname,$sDBusername,$sDBpassword)) { // connection ok - work with it } else { // database down - work around it } // continue with rest of page Rather than using the following, which causes the page to quit in mid flow: mssql_connect($sDBhostname,$sDBusername,$sDBpassword) or die("DATABASE FAILED TO RESPOND."); Thanks Andy Clarke

« previous php.general (#132571) next »