What are the potential risks of using the outdated mysql_* functions in PHP?

Using the outdated mysql_* functions in PHP poses security risks as they are vulnerable to SQL injection attacks and lack support for newer MySQL features. It is recommended to switch to MySQLi or PDO for improved security and compatibility with modern 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);
} else {
    echo "Connected successfully";
}