title: cakephp : how can i display count for each category?
body: <p>here is my tables</p>
  
  <p><strong>brands_tbls</strong></p>
  
  <ul>
  <li><code>id</code> <code>1</code> <code>2</code> <code>3</code> <code>4</code></li>
  <li><code>name</code> <code>Levi's</code> <code>Lee</code> <code>Woodland</code> <code>Spyakr</code></li>
  </ul>
  
  <p><strong>product_tbls</strong></p>
  
  <ul>
  <li><code>id</code></li>
  <li><code>brands_tbls_id</code></li>
  <li><code>product_description</code></li>
  <li><code>name</code></li>
  <li><code>price</code></li>
  </ul>
  
  <p>I m displaying my brands and also tried for product count by using this code.</p>
  
  <p><strong>PublicController.php</strong></p>
  
  <pre><code>public function example()
  {
      $this-&gt;loadModel("Brand");
      $data = $this-&gt;Brand-&gt;find('all');
      $this-&gt;set('brand', $data);
      $this-&gt;layout="display";
  
  
      $this-&gt;loadModel("Product");
      $data = $this-&gt;Product-&gt;find('count', array('conditions' =&gt;
                                    array('brands_tbls_id' =&gt; '1')));
      $this-&gt;set('product1', $data);
      $this-&gt;layout="display";
  }
  </code></pre>
  
  <p>below is my view file</p>
  
  <p><strong>example.ctp</strong></p>
  
  <pre><code>&lt;?php foreach($brand as $data) : ?&gt;
    &lt;?php foreach($data as $row) : ?&gt;
     &lt;li&gt;
       &lt;a href="#"&gt;
          &lt;span class="pull-right"&gt;(&lt;?php echo $product1;//--count   ?&gt;)
          &lt;/span&gt;&lt;?php echo $row["name"];//--brands   ?&gt;
       &lt;/a&gt;
     &lt;/li&gt;
     &lt;?php endforeach; ?&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>by doing this i can get count of product from <code>product_tbls</code> where <code>brands_tbls_id</code> = <code>1</code> </p>
  
  <p>so it will display same product count for all brands.how can i get product count for all brands?</p>