05-07-2008, 06:04 AM
|
#1 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
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_SERVER, DB_USER, DB_PASS, DB_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...
|
|
|
|