mysqli_fetch_array while loop columns

The mysqli_fetch_array() function in PHP is used to retrieve rows of data from a MySQL database query result, and return the data as an array. When used in a while loop, it can be used to iterate through all the rows of data returned by the query.

The mysqli_fetch_array() function takes two parameters: the result of the query, and a constant that specifies the type of array that should be returned (e.g. MYSQLI_NUM for a numerically indexed array, or MYSQLI_ASSOC for an associative array).

You can use the function in the following way:

<?php

$result = mysqli_query($conn, $query);
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
  echo $row['column_name'];
}

You can access the columns by their name.