What are the potential risks of using mysql_connect in PHP for database connections?

Using `mysql_connect` in PHP for database connections is risky because it is deprecated and has been removed in newer versions of PHP. It is recommended to use `mysqli_connect` or PDO for database connections to ensure compatibility and security.

$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

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

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