How can content from a database be displayed in two columns in PHP?

To display content from a database in two columns in PHP, you can fetch the data from the database and then loop through the results to display them in two separate columns using HTML. You can achieve this by using a counter to determine when to start a new column.

<?php
// Assuming $results is an array of data fetched from the database
$num_results = count($results);
$counter = 0;

echo '<div class="row">';
foreach ($results as $result) {
    if ($counter % 2 == 0) {
        echo '<div class="col-md-6">';
    }

    // Display your data here
    echo '<p>' . $result['column_name'] . '</p>';

    if ($counter % 2 != 0 || $counter == $num_results - 1) {
        echo '</div>';
    }

    $counter++;
}
echo '</div>';
?>