What are the implications of using deprecated mysql_* functions in PHP code, especially in relation to PHP 7 compatibility?

The use of deprecated mysql_* functions in PHP code poses a security risk and is not compatible with PHP 7 and newer versions. To address this issue, it is recommended to switch to mysqli or PDO for database operations.

// Connect to MySQL using mysqli
$mysqli = new mysqli("localhost", "username", "password", "database");

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

// Perform a query using mysqli
$result = $mysqli->query("SELECT * FROM table");

// Fetch results
while ($row = $result->fetch_assoc()) {
    // Process each row
}

// Close connection
$mysqli->close();