title: Zend Framework - counting rows in select clause?
body: <p>I'm investigating Zend Framework and currently stucked in counting resulting rows of sql query... Every method I try (from documentation and some blogposts and tutorials) returns an error (like <code>Call to undefined function</code>) or simply gives the incorrect value.</p>
  
  <p>I've tried this:</p>
  
  <pre><code>$checkquery = $db-&gt;select()
     -&gt;from('users', 'COUNT(*)')
     -&gt;where('login = ?', $login)
     -&gt;where('password = ?', $password)
     -&gt;query();
  
  $checkrequest=fetchRow($checkquery)-&gt;num;
  </code></pre>
  
  <p>...then this one:</p>
  
  <pre><code>$checkquery = $db-&gt;select()
     -&gt;from('users', '*')
     -&gt;where('login = ?', $login)
     -&gt;where('password = ?', $password)
     -&gt;query();
  
  $checkrequest=count($checkquery-&gt;fetchAll());
  </code></pre>
  
  <p>and even:</p>
  
  <pre><code>$checkquery = $db-&gt;select()
     -&gt;from('users', '*')
     -&gt;where('login = ?', $login)
     -&gt;where('password = ?', $password)
     -&gt;query();
  
  $checkrequest=$checkquery-&gt;fetchAll()-&gt;num;
  </code></pre>
  
  <p>Also <code>rowCount()</code> and <code>count(fetchRow())</code> and <code>count(fetchAll()-&gt;toArray())</code>. But always I got an error message or duplicate inserts in db in further insert function. So what is the correct way to do the resulting row calculation in select clause in Zend Framework 1.9 (I use this one) ? </p>