maintaining continuous count in php
<p>I have a small problem maintain a count for the position. i have written a function function that will select all the users within a page and positions them in the order.</p>

<p>Eg:<br>
Mike Position 1<br>
Steve Postion 2..............<br>
....<br>
Jacob Position 30<br></p>

<p>but the problem that i have when i move to the second page, the count is started from first
Eg: Jenny should be number 31 but the list goes,</p>

<p>Jenny Position 1 <br>
Tanya Position 2.......</p>

<p>Below is my function</p>

<pre><code>function nrk($duty,$page,$position)
{
    $url="http://www.test.com/people.php?q=$duty&amp;start=$page";

    $ch=curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    $result=curl_exec($ch);


        $dom = new DOMDocument();
        @$dom-&gt;loadHTML($result);

        $xpath=new DOMXPath($dom);
        $elements = $xpath-&gt;evaluate("//div");
        foreach ($elements as $element)
        {
            $name  = $element-&gt;getElementsByTagName("name")-&gt;item(0)-&gt;nodeValue;
            $position=$position+1;
            echo $name." Position:".$position."&lt;br&gt;";
        }   
            return $position;
    }
</code></pre>

<p>Below is the for loop where i try to loop thru the page count</p>

<pre><code>for ($page=0;$page&lt;=$pageNumb;$page=$page + 10)
        {
            nrk($duty,$page,$position);
        }
</code></pre>

<p>I dont want to maintain a array key value in the for each coz i drop certain names...</p>
