title: Automatic pagination for status board program
body: <p>i have more data's in my mysql database. i want to display the data, per page 10 data only i need to display, for this i wrote pagination code. its working very fine but i want to run  that pagination automatically that means automatically after few seconds the page turns to second page then third page etc... but i don't know how to implement please help anyone. Here below the sample code for reference:</p>
  
  <pre><code>    &lt;?php
  include "config.inc";
  
  $sql = "SELECT COUNT(*) FROM test";
  $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR);
  $r = mysql_fetch_row($result);
  $numrows = $r[0];
  
  
  $rowsperpage = 3;
  
  $totalpages = ceil($numrows / $rowsperpage);
  
  
  if (isset($_GET['currentpage']) &amp;&amp; is_numeric($_GET['currentpage'])) {
  
  $currentpage = (int) $_GET['currentpage'];
  } else {
  
  $currentpage = 1;
  }
  
  
  if ($currentpage &gt; $totalpages) {
  
  $currentpage = $totalpages;
  } 
  if ($currentpage &lt; 1) {
  
  $currentpage = 1;
  } 
  
  
  $offset = ($currentpage - 1) * $rowsperpage;
  
  
  $sql = "SELECT * FROM test LIMIT $offset, $rowsperpage";
  $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR);
  
  
  while ($list = mysql_fetch_array($result)) {
  
  echo $list['mark_cut_weld'] . " : " . $list['mark_cut_inves'] . "&lt;br /&gt;";
  } 
  
  
  $range = 3;
  
  
  if ($currentpage &gt; 1) {
  
  echo " &lt;a href='{$_SERVER['PHP_SELF']}?currentpage=1'&gt;&lt;&lt;&lt;/a&gt; ";
  
  $prevpage = $currentpage - 1;
  
  echo " &lt;a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'&gt;&lt;&lt;/a&gt; ";
  } 
  
  
  for ($x = ($currentpage - $range); $x &lt; (($currentpage + $range) + 1); $x++) {
  
  if (($x &gt; 0) &amp;&amp; ($x &lt;= $totalpages)) {
  
  if ($x == $currentpage) {
  
   echo " [&lt;b&gt;$x&lt;/b&gt;] ";
  
  } else {
  
   echo " &lt;a href='{$_SERVER['PHP_SELF']}?currentpage=$x'&gt;$x&lt;/a&gt; ";
  } 
  } 
  } 
  
  
  if ($currentpage != $totalpages) {
  
  $nextpage = $currentpage + 1;
  
  echo " &lt;a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'&gt;&gt;&lt;/a&gt; ";
  
  echo " &lt;a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'&gt;&gt;&gt;&lt;/a&gt; ";
  } 
  ?&gt;
  </code></pre>
  
  <p>Above code, i just fetch the data from mysql database by php. then set the data per page is 3. i just get the total count and then divide by number of rows into rows per page... then automatically it will display the data. </p>
  
  <p>My target is display the data from database. per page 10 data's and then automatically it move to next page for next 10 data without any action click or submit... 
      Because it is status board program..  we going to display by big tv in factory... so workers can see the status of the work in this big tv.</p>