What are the potential consequences of continuing to use the deprecated mysql extension in PHP?

Using the deprecated mysql extension in PHP can lead to security vulnerabilities, compatibility issues with newer versions of PHP, and lack of support for modern database features. To address this, you should switch to either the MySQLi or PDO extension, which offer improved security, support for prepared statements, and better compatibility with current PHP versions.

// Connect to MySQL using MySQLi extension
$mysqli = new mysqli('localhost', 'username', 'password', 'database');

// Check connection
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}