CodeIgniter Forums
displaying distinct() results - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: displaying distinct() results (/thread-28454.html)

displaying distinct() results - El Forum - 03-11-2010

I believe that I am set up correctly but my foreach loop is not displaying distinct results only.

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('thoughts_view', $data);

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

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