What are some alternative ways to display query results in PHP other than using a while loop and echo statements?

When displaying query results in PHP, using a while loop and echo statements can be repetitive and cumbersome, especially for large datasets. An alternative approach is to use PHP's built-in functions like `mysqli_fetch_all()` or `mysqli_fetch_assoc()` to fetch all rows at once or fetch rows as associative arrays, respectively. These functions can simplify the code and make it more readable.

// Assuming $result is the result of a database query

// Fetch all rows at once as an associative array
$rows = mysqli_fetch_all($result, MYSQLI_ASSOC);

// Loop through the rows and display the data
foreach ($rows as $row) {
    echo $row['column_name'] . "<br>";
}