What are the differences between using procedural and object-oriented styles for MySQL connections in PHP?

When connecting to a MySQL database in PHP, the procedural style involves using functions like `mysqli_connect` and `mysqli_query` to interact with the database, while the object-oriented style involves creating a `mysqli` object and using its methods to perform database operations. The object-oriented style is generally considered more modern and flexible, allowing for better code organization and reusability.

// Procedural style MySQL connection
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

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

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

// Object-oriented style MySQL connection
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

$conn = new mysqli($servername, $username, $password, $dbname);

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