How does object-oriented usage differ between MySQLi and MySQL in PHP?

When using object-oriented programming with MySQLi in PHP, you create a connection object using the `mysqli` class and then use methods of that object to interact with the database. On the other hand, when using the deprecated MySQL extension in PHP, you would use functions like `mysql_connect()` and `mysql_query()`.

// Object-oriented MySQLi usage
$mysqli = new mysqli("localhost", "username", "password", "database");

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

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

while ($row = $result->fetch_assoc()) {
    echo $row['column_name'] . "<br>";
}

$mysqli->close();