I want to set up a database connetion, if the connection fails the user should be redirected to an error page, could you help?
Here is my current connection code:

```
<?php
    $hostname='localhost'; 
    $user='username';
    $pass='pasddword'; 
    $dbase='db_name';
    $connection = mysql_connect("$hostname" , "$user" , "$pass") 
            or die ("Can't connect to MySQL");
    $db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
?>

```