Exception handling in php when using mysql statements.
try {
if(!@mysql_connect($db['hostname'],$db['username'],$db['password'])){
throw new Exception("Database connection failed. Please correct it and continue.");
}
}
catch(exception $e) {
echo $e->getMessage();
exit;
}
try {
if(!@mysql_connect($db['hostname'],$db['username'],$db['password'])){
throw new Exception("Database connection failed. Please correct it and continue.");
}
}
catch(exception $e) {
echo $e->getMessage();
exit;
}
No comments:
Post a Comment