View Single Post
Old 05-07-2008, 06:04 AM   #1 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default Exceptions and suppressing mysqli errors

I'm just learning about exceptions and the Exception class, so I decided to give this a go;

PHP Code:
// in my construct

try {
    
$this->connectDB();
} catch (
Exception $e) {
    
$e->getMessage();
    die;
}

// the method

private function connectDB () {
    
$this->mysqli = @new mysqli(DB_SERVERDB_USERDB_PASSDB_NAME);
    if (!
is_object($this->mysqli)) {
        throw new 
Exception ("I'm sorry Dave, I'm afraid I can't do that.");
    }

The problem is the @ doesn't seem to be suppressing the error from calling a new mysqli object...
delayedinsanity is offline  
Reply With Quote