How can I make this function work with php 7.2? : <p>I have this piece of code that works fine with php5.6 but it breaks with php7.2.
I had three errors and I was able to fix two, I believe :)</p>

<pre><code>$link = mysql_connect($hostname, $username, $password);
if (!$link) {
    die('Could not connect !');
    exit();
}
else{
    mysql_set_charset('utf8',$link);
    mysql_select_db($database, $link) or die('Could not select database.');
    }
</code></pre>

<p>this is what I have so far</p>

<pre><code>$link = mysqli_connect($hostname, $username, $password);
if (!$link) {
    die('Could not connect !');
    exit();
}
else{
    mysqli_set_charset('utf8',$link);
    mysqli_select_db($database, $link) or die('Could not select database.');
    }
</code></pre>

<p><strong>Fatal error</strong> with mysql_select_db()</p>

<p>How can I make this function work with php 7.2? any help will be greatly appreciated, thank you in advance!!</p>
