What are the potential security risks of using outdated functions like mysql_connect in PHP?

Using outdated functions like `mysql_connect` in PHP poses security risks because these functions are deprecated and no longer receive updates or security patches. This can leave your application vulnerable to SQL injection attacks and other security threats. To mitigate these risks, it is recommended to use modern functions like `mysqli_connect` or PDO for database connections in PHP.

// Connect to MySQL using mysqli_connect
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

$conn = mysqli_connect($servername, $username, $password, $dbname);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}