title: Count and display result based on type in codeigniter
body: <p>I have the following table</p>
  
  <pre><code>|id|user_type|
  |1|Customers|
  |2|Suppliers|
  |3|Customers|
  |4|Suppliers|
  |5|Suppliers|
  |6|Employees|
  </code></pre>
  
  <p>I want to count total customers, suppliers, employess</p>
  
  <p><li>Customers (2)</li>
  <li>Suppliers (3)</li>
  <li>Employees (1)</li></p>
  
  <p>Here are my html</p>
  
  <pre><code>       &lt;a href="#" class="customers list-group-item"&gt;
              &lt;span class="badge badge-info"&gt;
                   2
              &lt;/span&gt;
              Customers
         &lt;/a&gt;
          &lt;a href="#" class="employees list-group-item"&gt;
              &lt;span class="badge badge-danger"&gt;
                  3               
             &lt;/span&gt;
              Employees           
         &lt;/a&gt;
          &lt;a href="#" class="suppliers list-group-item"&gt;
              &lt;span class="badge badge-success"&gt;
                  1               
                &lt;/span&gt;
              Suppliers           
         &lt;/a&gt;
  </code></pre>
  
  <p>My query code look like this</p>
  
  <pre><code>     &lt;?php
                   $this-&gt;load-&gt;model("User_model");
                   $query = $this-&gt;db-&gt;query('SELECT user_type, COUNT(Customers) AS total FROM `users` GROUP BY user_type');
  
         if ($query-&gt;num_rows() &gt; 0)
      foreach ($query-&gt;result() as $row) 
          $data['users'] = array(
              'total' =&gt; $row-&gt;total,
          );
  
  echo $data['users'];
  </code></pre>
  
  <p>This code does not working. Thank you for your time.</p>