What are the potential pitfalls of using the deprecated mysql functions in PHP 7 and how can they be addressed?

Using deprecated mysql functions in PHP 7 can lead to security vulnerabilities and compatibility issues with newer versions of PHP. To address this, you should switch to using mysqli or PDO for interacting with MySQL databases.

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

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