What is the potential issue with using the mysql extension in PHP?

The potential issue with using the mysql extension in PHP is that it has been deprecated as of PHP 5.5.0 and removed in PHP 7.0.0. This means that it is no longer supported and may lead to security vulnerabilities and compatibility issues. To solve this problem, you should switch to either the MySQLi or PDO extension, which are more secure and provide better features for interacting with MySQL databases.

// Connect to MySQL using MySQLi extension
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";