What are the potential pitfalls of using mysql_connect and mysql_select_db functions in PHP?

The potential pitfalls of using mysql_connect and mysql_select_db functions in PHP are that they are deprecated as of PHP 5.5.0 and removed in PHP 7.0.0. It is recommended to use MySQLi or PDO_MySQL extensions instead for improved security and functionality.

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