How can PHP warnings related to mysqli_query and mysqli_fetch_array be resolved when migrating from mysql to mysqli?

When migrating from mysql to mysqli, PHP warnings related to mysqli_query and mysqli_fetch_array can be resolved by ensuring that the connection object is used as the first parameter in these functions. This means passing the connection object as the first parameter in mysqli_query and using the result object returned by mysqli_query in mysqli_fetch_array.

// Establish connection to MySQL database using mysqli
$connection = mysqli_connect("localhost", "username", "password", "database");

// Use the connection object as the first parameter in mysqli_query
$result = mysqli_query($connection, "SELECT * FROM table");

// Use the result object returned by mysqli_query in mysqli_fetch_array
while($row = mysqli_fetch_array($result)){
    // Process each row as needed
}