What is the potential issue with the given PHP code for establishing a MySQL connection?
The potential issue with the given PHP code is that it is using the deprecated `mysql_connect` function to establish a MySQL connection. This function has been removed in newer versions of PHP and is no longer recommended for use. To fix this issue, you should use the `mysqli_connect` function or PDO to establish a secure and up-to-date connection to the MySQL database.
// Fix for establishing a MySQL connection using mysqli_connect
$servername = "localhost";
$username = "username";
$password = "password";
$database = "dbname";
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}