title: PHP limit rows and columns per page
body: <p>I have 300+ records.</p>
  
  <pre><code>id | name | last_name                | gender 
  -----------------------------------------------
  1  | John | Doe                      | Male
  2  | Jane | Smith Dolores Clayborne  | Female
  3  | Paul | Paulson                  | Male
  .
  .
  .
  300 | Jake | Jacob                   | Male
  </code></pre>
  
  <p>I want to display it in my table that has 5 columns and 50 rows each page. so next page will show another rcolumns and 50 records. </p>
  
  <p>my code below</p>
  
  <pre><code>$req = "SELECT * FROM  `directory` "; 
  
  $query = mysql_query($req);
  
  echo '&lt;table&gt;';
  while($row = mysql_fetch_array($query))
  {
      echo $row['name'];
  }
  echo '&lt;/table&gt;';
  </code></pre>
  
  <p>this query will show 300 records in one column</p>
  
  <p>i just need to show it on 5 column.</p>
  
  <p>supposed to be the result below would be:</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;&lt;td&gt;VALUE1&lt;/td&gt;&lt;td&gt;VALUE2&lt;/td&gt;&lt;td&gt;VALUE3&lt;/td&gt;&lt;td&gt;VALUE4&lt;/td&gt;&lt;td&gt;VALUE5&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;VALUE6&lt;/td&gt;&lt;td&gt;VALUE7&lt;/td&gt;&lt;td&gt;VALUE8&lt;/td&gt;&lt;td&gt;VALUE9&lt;/td&gt;&lt;td&gt;VALUE10&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;VALUE11&lt;/td&gt;&lt;td&gt;VALUE12&lt;/td&gt;&lt;td&gt;VALUE13&lt;/td&gt;&lt;td&gt;VALUE14&lt;/td&gt;&lt;td&gt;VALUE15&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Thanks.</p>