I can't connect to my SQL database. : <p>This is the code I've been using. And when I open it always says "Cannot connect to the server"</p>

<p>Please help me</p>

<pre><code>&lt;?php

define('HOST','localhost');
define('USER','root');
define('PASSWORD','');
define('DATABASE','trialdb');

$link = mysqli_connect(HOST,USER,PASSWORD,DATABASE);
mysqli_select_db($link,DATABASE);

if (mysqli_connect(HOST,USER,PASSWORD,DATABASE)) {
    die("Cannot connect to the server!");
} else {
    echo "Success! You are connected to the server!&lt;br /&gt;";
}
if (mysqli_select_db($link,DATABASE)) {
    echo "Success! You are now connected to the database.";
} else {
    die ("Cannot connect to the database!");
}
?&gt;
</code></pre>
