What are the potential drawbacks of using the old MySQL extension in PHP for database queries?

Using the old MySQL extension in PHP for database queries can lead to security vulnerabilities and deprecated functionality. It is recommended to switch to MySQLi or PDO extensions, which offer better security features and support for newer MySQL 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);
}