pg_connect() is showing the error in table format.Instead of showing error message as table format need a error message alert.
Error Message
pg_connect
does not throw exception, so you have to translate to exception like below.
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler("exception_error_handler");
try {
$conn=@pg_connect("host=dbhost user=dbuser dbname=db password=dbpass");
} Catch (Exception $e) {
Echo $e->getMessage();
}
Please refer this more detail
http://php.net/manual/en/language.exceptions.php