title: how to Fix Pagination using PHP
body: <p>hi everyone i am trying to create my pagination in below format</p>
  
  <p>Go to Page 3 [text-box] Previous 1 2 3 4 5 ....400 Next</p>
  
  <p>and below is my code</p>
  
  <pre><code>             if(isset($_REQUEST['limit_start']) &amp;&amp; $_REQUEST['limit_start'] &gt; 0) $limit_start = $_REQUEST['limit_start'];
          else  $limit_start = 0 ;
          if(isset($_REQUEST['results_to_show']) )  $results_to_show= $_REQUEST['results_to_show'];
          else $results_to_show = 100;
  
          if(($limit_start-$results_to_show)&gt;=0)
          $pagination.='&lt;a href="details-inventory.php?limit_start='.($limit_start-$results_to_show).'&amp;&amp;results_to_show='.$results_to_show.'" &gt;Previous&lt;/a&gt; | ';
  
            if (isset($_REQUEST['submit']) &amp;&amp; $_REQUEST['submit'] != "")$search_limited = 1;
            else $search_limited = 0;
  
          global $wpdb;
          $sql='SELECT count(*) 
          FROM `inventory_location` ';
  
          $data= $wpdb-&gt;get_results($sql,ARRAY_A);
           $row_count= $data[0]['count(*)']; 
  
          for($number=(($limit_start/$results_to_show)+1);$number&lt;($row_count/$results_to_show);$number++)//($row_count/$results_to_show);$number++)($limit_start/$results_to_show)+
          $pagination.= '&lt;a href="details-inventory.php?limit_start='.($number*$results_to_show).'&amp;&amp;results_to_show='.$results_to_show.'" &gt;'.$number.'&lt;/a&gt; | ';
  
          $pagination.= ' &lt;a href="details-inventory.php?limit_start='.($limit_start+$results_to_show).'&amp;&amp;results_to_show='.$results_to_show.'" &gt;Next &lt;/a&gt; &lt;br /&gt;';
  </code></pre>
  
  <p>Now the problem is this ..... 
  it show all the numbers from 1 to last page ... i want to break it in below style </p>
  
  <pre><code>   1 2 3 4 5 ....400
  </code></pre>
  
  <p>thanx</p>