title: How to count based on where in mysql? php
body: <p>I was wondering how can I make a query that will show the counts that I need using codeigniter?</p>
  
  <p>EX: Submitted to select 90 and 56</p>
  
  <pre><code>$this-&gt;db-&gt;where('atr_id', 90);
  $this-&gt;db-&gt;or_where('atr_id', 56);
  </code></pre>
  
  <p>List_table</p>
  
  <pre><code>   id     |    item_id    |   atr_id
  ---------------------------------------
     1      |        1      |    56
     2      |        1      |    90
     3      |        2      |    56
     4      |        2      |    90
     5      |        2      |    92
  </code></pre>
  
  <p>The expected return would look like this.</p>
  
  <pre><code>    item_id    |  active_attr   |  total_attr  
  ----------------------------------------------
          1      |        2       |     2        // active_attr (90,56) and total_attr (90 , 56)
          2      |        2       |     3        // active_attr (90,56) and total_attr (90, 56, 92)
  </code></pre>
  
  <p>The <code>active_attr</code> counts the number of <code>atr_id</code> found (90, 56) in an <code>item_id</code></p>
  
  <p>And the <code>total_attr</code> counts the total number of <code>atr_id</code> of an <code>item_id</code></p>
  
  <p>Need really help here thanks guys...</p>