title: PHP pagination function
body: <pre><code>public function paging($limit,$numRows,$page){
  
      $allPages       = ceil($numRows / $limit);
  
      $start          = ($page - 1) * $limit;
  
      $querystring = "";
  
      foreach ($_GET as $key =&gt; $value) {
          if ($key != "page") $paginHTML .= "$key=$value&amp;amp;";
      }
  
      $paginHTML = "";
  
      $paginHTML .= "Pages: ";
  
      for ($i = 1; $i &lt;= $allPages; $i++) {
          $paginHTML .= "&lt;a " . ($i == $page ? "class=\"selected\" " : "");
          $paginHTML .= "href=\"?{$querystring}page=$i";
          $paginHTML .= "\"&gt;$i&lt;/a&gt; ";
      }
  
      return $paginHTML;
  
   }
  </code></pre>
  
  <p>This is my pagination function for MVC pattern implementation.But this function has not displayed next and prev links.</p>
  
  <p>I need to return HTML variable for pagination with previous and next link to controller.</p>
  
  <p>I passed these variable to this function from controller.</p>
  
  <pre><code>$limit,$numRows,$page
  </code></pre>
  
  <p>How can I get next and prev links to above function.</p>