Codeigniter view file looping query
        Posted  
        
            by 
                user2505513
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user2505513
        
        
        
        Published on 2013-06-29T22:06:05Z
        Indexed on 
            2013/06/29
            22:21 UTC
        
        
        Read the original article
        Hit count: 263
        
Right, I'm unsure about how to code my view file to generate following query results WITHOUT compromising the principles of mvc.
Query in model:
SELECT * FROM events GROUP BY country, area ORDER BY country, area
View:
<?php if (isset($query)):?>
<?php foreach ($query as $row):?>
<h2><?=$row->country?></h2>
<h3><?=$row->area?></h3>
<?php endforeach;?>
<?php endif;?>
I want the results to display:
England North South West - utilising the GROUP BY parameter
As opposed to:
England North England South England West
Has anybody any advice as to how to achieve this?
© Stack Overflow or respective owner