What are the potential issues with using MySQL functions in PHP and how can they be resolved?

Potential issues with using MySQL functions in PHP include deprecated functions, security vulnerabilities, and lack of portability to other database systems. To resolve these issues, it is recommended to use MySQLi or PDO extensions in PHP for interacting with MySQL databases.

// Using MySQLi extension to connect to a MySQL database
$mysqli = new mysqli('localhost', 'username', 'password', 'database_name');

if ($mysqli->connect_error) {
    die('Connection failed: ' . $mysqli->connect_error);
}