I'm trying to connect to the database using localhost.
<?php
     //Connecting to the Database
     $servername = "localhost";
     $username = "root";
     $password = "";
    // Create a connection
    $conn = mysqli_connect($servername, $username, $password);
    // Die if connection was not successful
    if (!$conn){
        die("Sorry we failed to connect: ". mysqli_connect_error());
    }
    else{
        echo "Connection was successful";
    }
?>
It works if the connection is made but I don't get the "Sorry we failed to connect" message when I intentionally create an error.
What could be the potential causes of this?
 
     
    