title: Codeigniter count number of articles in one category while listing categories
body: <p>I have some problem while listing categories from database.</p>
  
  <p>First i have a table called "Videos" where i store som videos-information like v_name, v_description and category_name.</p>
  
  <p>In the second table called "Categories" where i store categories-information like c_name and c_description.</p>
  
  <p>OFC i have id's in every table :)</p>
  
  <p>But now i want to list the categories and in the same query count every videoitem in every category.</p>
  
  <p>This is the code and i can't figure out how to do in the model now and later how to show the numbers in the view file, so pleace help me!</p>
  
  <p>Thanks for your time and support :D</p>
  
  <pre><code>    $this-&gt;db-&gt;select('c.*');
      $this-&gt;db-&gt;from('categories as c');
      $this-&gt;db-&gt;join('videos as v', 'c.c_name = v.v_category', 'right');
      return $this-&gt;db-&gt;get()-&gt;result_array();
  </code></pre>