• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
displaying distinct() results

#1
[eluser]elaniobro[/eluser]
I believe that I am set up correctly but my foreach loop is not displaying distinct results only.

controller:
Code:
function index()
        {
            
            
            $data['page'] = 'thoughts';
            $data['query'] = $this->db->order_by('id DESC')->get('thoughts');
            $data['tag'] = $this->db->distinct('tag')->get('thoughts');

            $this->load->view('header', $data);
            $this->load->view('campaign');
            $this->load->view('thoughts_view', $data);
            $this->load->view('footer');
            
        }

and the foreach loop in the view:
Code:
<ul>
                            Tags:<br />
                            <ul>
                            &lt;?php foreach($tag->result() as $row):?&gt;
                            <li>&lt;?= $row->tag?&gt;</li>
                            &lt;?php endforeach;?&gt;
                            </ul>
                        </ul>

Not getting any errors, so I assume the syntax is correct, but apparently my implementation of it is not.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.