When I put a try-catch around mysqli_connect, specifically passing in bad values, the error never seems to catch. Any clue why this is?
PHP Code:define('_CONN_HOST_', 'foo');
define('_CONN_USER_', 'bar');
define('_CONN_PASS_', 'this');
define('_CONN_DATA_', 'that');
final class Connection {
function __construct($host = _CONN_HOST_, $user = _CONN_USER_, $pass = _CONN_PASS_, $data = _CONN_DATA_) {
try {
mysqli_connect($host, $user, $pass, $data);
} catch (Exception $e) {
echo 'Error';
}
}
}
$conn = new Connection();
unset($conn);







Bookmarks