How can the fetch_array function in PHP be utilized to retrieve results from a mysqli_query?

To retrieve results from a mysqli_query in PHP, you can utilize the fetch_array function to fetch a row as an associative array, a numeric array, or both. This function allows you to easily access the data returned by the query and process it accordingly.

// Assuming $mysqli is your mysqli connection object and $query is your mysqli_query result

$result = $mysqli->query($query);

while ($row = $result->fetch_array()) {
    // Process each row of the result set
    // You can access the data using $row['column_name']
}