I am using the code below to print from an array but its printing too many of the columns because i am using a foreach loop...
How can i print just 1 col1 and 1 col2 but keeping the right strings being printed which is working?
<div class="feature-text">
<?php
//Now print the associated cms_page_parts
$qpp = $conn->query("SELECT * FROM cms_page_part WHERE page_id=$id");
$rpp = $qpp->fetchAll(PDO::FETCH_ASSOC);
foreach ($rpp as $row) {
?>
<div id="col1">
<p><?php echo $row['name']=='body' ? $row['content_html'] : NULL; ?></p>
</div>
<div id="col2">
<p class="testimonial"><?php echo $row['name']=='sidebar' ? $row['content_html'] : NULL; ?></p>
</div>
<?php
}
?>
</div>