title: Auto increment inside a loop
body: <p>I need to auto increment an array value inside a <code>while</code> loop. If the array value is <code>$Values[2]</code>, I need it to be <code>$Values[3]</code> on the next loop. What I have is not providing any results.</p>
  
  <pre><code>//select the top spread winners
  $query_moline = "SELECT * FROM `highscore_leader` WHERE `game_id`=\"$game_id\" AND `leader_id`&lt;&gt;\"$curmemid\" AND `score`&gt;\"$myscore\" AND `active`='Y' ORDER BY `score` DESC LIMIT \"$top_payout\"";
  $moline = mysql_query($query_moline) or die(mysql_error());
  $row_moline = mysql_fetch_assoc($moline);
  $totalRows_moline = mysql_num_rows($moline);
  
  $index=$top_payout;
  static $i=2;
  
  do {
  
  $score_id=$row_moline['id'];
  $player_id=$row_moline['leader_id'];
  
  if($totalRows_moline&gt;0){
  foreach ($row_moline['id'] as $scoreid)
       {
          $i++;
       }
  $player_comission=$values[$i];
  //update payout tables
  $strsql="UPDATE `ttourmember` SET `accountamount`=(`accountamount`+\"$player_comission\") WHERE `memberid`=\"$player_id\"";
  mysql_query($strsql,$connect) or die(mysql_error());
  $chkrow3=mysql_affected_rows($connect); 
  
  }} while ($row_moline = mysql_fetch_assoc($moline));
  </code></pre>