title: PHP/MySQL - Incrementing variable name to loop for data
body: <p>I have rows in my <code>teams</code> table named <code>player1</code>, <code>player2</code>, <code>player3</code> ... <code>player12</code>. In PHP script i set them as variables (<code>$player1</code>,<code>$player2</code>...) and want to loop through them to check if they are <code>NULL</code>, and if they are not to count them.</p>
  
  <p>How may I increment a variable in PHP? I have tried doing it likes this:</p>
  
  <pre><code>&lt;?
      $playerspicked = 0;
      for($i = 1; $i &lt;= 12; $i++) {
          $playercheck = "$player"+$i;
          if($playercheck != 0) {
              $playerspicked++;
          }
      }
  ?&gt;
  </code></pre>
  
  <p>but this wouldn't work.</p>