title: Issues adding a set of database columns to array
body: <p>I have the following table that queries users from my database and then adds 14 players under each user. I added a couple of columns to the same database table and I am trying to get the columns to echo out and it is throwing an undefined index error, but I'm not entirely sure where I can define it in here.</p>
  
  <p>This is the part I am trying to get the new columns to echo out at. I have 14 players, so this array runs through them all for each user. I am adding the same number of 'positions' So it will be player1 position1, player2 position2, etc.</p>
  
  <pre><code>for ($playerNum = 1; $playerNum &lt;= $totalPlayerNumbers; $playerNum++) {
      echo '&lt;tr&gt;&lt;td&gt;&lt;div class="draftBorder"&gt;' . $playerNum . '&lt;/div&gt;&lt;/td&gt;';
      foreach ($userPlayerStore as $userPlayer) {
          echo '&lt;td&gt;&lt;div class="draftBorder"&gt;' . $userPlayer['player' . $playerNum] . '&lt;/div&gt;&lt;/td&gt;';
  </code></pre>
  
  <p>I tried to do this and this is why I am getting the errors...</p>
  
  <pre><code> foreach ($userPlayerStore as $userPlayer) {
      echo '&lt;td&gt;&lt;div class="draftBorder"&gt;' . $userPlayer['player' . ' - ' . 'position' . $playerNum] . '&lt;/div&gt;&lt;/td&gt;';
  </code></pre>
  
  <p>How else can I format this, so that I can get the position to show up next to the player. Like this:</p>
  
  <p>Player1 - Position1</p>
  
  <p>Full code:</p>
  
  <pre><code>&lt;?php $userPlayerStore = array(); ?&gt;
  
  &lt;table class="draft_border_table"&gt;
      &lt;tr&gt;
          &lt;th&gt;Rnd&lt;/th&gt;
  
  &lt;?php
  
  // Output usernames as column headings
  $userResults = mysqli_query($con, 'SELECT * FROM user_players ORDER BY `id`');
  while($userPlayer = mysqli_fetch_array($userResults)) {
      $userPlayerStore[] = $userPlayer;
      echo '&lt;th&gt;&lt;div&gt;' . $userPlayer['username'] . '&lt;/div&gt;&lt;/th&gt;';
  }
  
  ?&gt;
  
      &lt;/tr&gt;
  
  &lt;?php
  
  // Output each user's player 1-14 in each row
  $totalPlayerNumbers = 14;
  for ($playerNum = 1; $playerNum &lt;= $totalPlayerNumbers; $playerNum++) {
  echo '&lt;tr&gt;&lt;td&gt;&lt;div class="draftBorder"&gt;' . $playerNum . '&lt;/div&gt;&lt;/td&gt;';
  foreach ($userPlayerStore as $userPlayer) {
       if (empty($userPlayer['player'.$playerNum])){
         $extra_class = 'emptycell';
      }else{
         $extra_class = 'filledcell';
      }
      echo '&lt;td class="draft_table_td"&gt;' . $userPlayer['player' . $playerNum] . '&lt;/td&gt;';
  }
  echo '&lt;/tr&gt;';
  }
  
  ?&gt;
  
  &lt;/table&gt;
  </code></pre>