What are some potential pitfalls of using the mysql extension in PHP?

One potential pitfall of using the mysql extension in PHP is that it has been deprecated since PHP 5.5.0 and removed in PHP 7.0.0. This means that using the mysql extension can lead to compatibility issues and security vulnerabilities. To address this, it is recommended to use the mysqli or PDO extensions for interacting with MySQL databases in PHP.

// 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);
}