How can the use of deprecated functions in PHP, such as mysql_query, impact the functionality of a website?

The use of deprecated functions like mysql_query in PHP can impact the functionality of a website as these functions are no longer supported and may lead to security vulnerabilities and errors. To resolve this issue, it is recommended to switch to using MySQLi or PDO for database operations in PHP.

// Using MySQLi to connect to a database and perform a query
$mysqli = new mysqli("localhost", "username", "password", "database");

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

$query = "SELECT * FROM table";
$result = $mysqli->query($query);

if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        echo "ID: " . $row["id"] . " - Name: " . $row["name"] . "<br>";
    }
} else {
    echo "0 results";
}

$mysqli->close();