Please, can I know what's wrong with this function. I want if the connection to database is not established to display a custom error message instead of the default exeption.
<?php 
    $host = "localhost";
    $user = "root";
    $pass = "";
    $dbname = "ts";
    $dbc = mysqli_connect($host,$user,$pass,$dbname);
    if( !$dbc){
        echo "failed to connect with database";
    }
?>
The right name of database is: tst Please how to solve the problem?
