title: Pagination for a query
body: <p>I have this functions to get all rows from anunturi table with ajax.</p>
  
  <pre><code>function view_user_anunt($user) {
  
  
           $query="SELECT t1.*, t2.*, t3.*
           FROM anunturi t1 
           INNER JOIN tranzactie t2 ON t1.tranzactie = t2.id_tranzactie
           INNER JOIN tip_proprietate t3 ON t1.tip = t3.id_prop
           WHERE t1.user=:code 
  ";
  
          $stmt = $this-&gt;dbh-&gt;prepare($query);
          $stmt-&gt;bindParam(':code', $user, PDO::PARAM_INT);
          $stmt-&gt;execute();
          $nr=$stmt-&gt;rowCount();
          echo $nr;
          foreach ($stmt-&gt;fetchAll(PDO::FETCH_ASSOC) as $result) 
          {
              $view[]="
              &lt;tr&gt;
              &lt;td&gt;".$result['id_anunt']."&lt;/td&gt;
              &lt;td&gt;".$result['den_tranzactie']."&lt;/td&gt;
              &lt;td&gt;".$result['den_prop']."&lt;/td&gt;
              &lt;td&gt;hehe&lt;/td&gt;
              &lt;td&gt;&lt;a href='#' id='vizualizare'&gt;Select&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href='#' id='modificare'&gt;Select&lt;/a&gt;&lt;/td&gt;
              &lt;/tr&gt;";
  
          }
  
      return $view;
  
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I need a solution to paginate this query.
  If is possible I need to be paginated with ajax and php.
  Thanks in advance....</p>