title: How do I make a MySQL infinite array table?
body: <p>I am using this code to create an infinite table for my mysql queries:</p>
  
  <pre><code>&lt;table cellspacing='0'&gt; &lt;!-- cellspacing='0' is important, must stay --&gt;
  
      &lt;!-- Table Header --&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;User&lt;/th&gt;
              &lt;th&gt;SteamID&lt;/th&gt;
              &lt;th&gt;Banned by&lt;/th&gt;
              &lt;th&gt;Admin SteamID&lt;/th&gt;
              &lt;th&gt;Time Banned (min)&lt;/th&gt;
              &lt;th&gt;Reason&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;!-- Table Header --&gt;
  
      &lt;!-- Table Body --&gt;
      &lt;tbody&gt;
  &lt;?php
  
  echo '&lt;tr&gt;';
  
  for($i = 0; $bans = mysqli_fetch_array($query2); $i = ($i+1)%3){
      echo '&lt;td&gt;'.$bans['name'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$bans['steamid'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$bans['nameAdmin'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$bans['steamidAdmin'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$bans['time'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$bans['reason'].'&lt;/td&gt;';
      if($i == 2)
          echo '&lt;/tr&gt;&lt;tr&gt;';
  }
  
  echo '&lt;/tr&gt;';
  
  ?&gt;
  
  &lt;/tbody&gt;
  </code></pre>
  
  <p>I got that code from <a href="https://stackoverflow.com/questions/6757082/mysql-fetch-array-table-results">Mysql fetch array, table results</a></p>
  
  <p>It works fine, except it doesn't CORRECTLY go further down than 6 rows. The other rows for whatever reason are placed to the right of my last column as shown in this screenshot:
  <a href="http://puu.sh/h0qZF/a12de1dd87.png" rel="nofollow noreferrer">http://puu.sh/h0qZF/a12de1dd87.png</a></p>
  
  <p>How can I fix this? Is there something wrong with my code? Why is it happening?</p>