Welcome Guest, Not a member yet? Register   Sign In
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.




Theme © iAndrew 2016 - Forum software by © MyBB