CodeIgniter Forums
how i can display each category latest entries - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: how i can display each category latest entries (/thread-60316.html)



how i can display each category latest entries - El Forum - 02-28-2014

[eluser]Ahmed Iqbal[/eluser]
we re using CodeIgniter, we want to get 6 categories latest 10 entries by (date), then we will display different categories results in view.

Code:
$this->db->select('*');
            $this->db->from('ci_categories');
            $this->db->join('ci_albums', 'ci_categories.cat_id = ci_albums.cat_id');
            $this->db->group_by('ci_albums.cat_id');
            $this->db->order_by('ci_albums.date', 'desc');
            $this->db->limit(10);


here is our query, this query return 6 latest entries result. 1 result come from 1 category. we need 10 result form each category. mean total 60 results.