Why is it recommended to avoid using the original mysql extension (mysql_ functions) in PHP due to deprecation and potential security risks?

The original mysql extension (mysql_ functions) in PHP is recommended to be avoided due to deprecation and potential security risks. It is no longer supported in newer versions of PHP, making it vulnerable to security threats and lacking in updated features. It is advised to switch to either MySQLi or PDO extensions for better security and compatibility with modern PHP versions.

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

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