How to count rows before while() : <p>I need to count rows before while(). </p>

<p>On page there are 10 questions. 5 questions on left, 5 questions on right.  </p>

<p>It looks like this: </p>

<pre><code>&lt;div class="left"&gt; 

&lt;div&gt;question 1&lt;/div&gt;
&lt;div&gt;question 2&lt;/div&gt;
&lt;div&gt;question 3&lt;/div&gt;
&lt;div&gt;question 4&lt;/div&gt;
&lt;div&gt;question 5&lt;/div&gt;
&lt;/div&gt; &lt;!-- /left close --&gt; 

&lt;div class="right"&gt; 

&lt;div&gt;question 6&lt;/div&gt;
&lt;div&gt;question 7&lt;/div&gt;
&lt;div&gt;question 8&lt;/div&gt;
&lt;div&gt;question 9&lt;/div&gt;
&lt;div&gt;question 10&lt;/div&gt;
&lt;/div&gt; &lt;!-- /right close --&gt;
</code></pre>

<p>Data getting from mysql.</p>
