bool isConnected()
This function tests if a database connection has been established or not. You can use this to provide a controlled response to connection failure. The result of this function is either false, or the connectionId of the database if connected (==true)
$conn = @connect($database,$user,$password); if (!$conn->isConnected()) /* * fail gracefully * /