title: Pagination not working properly after adding in button for admin
body: <p>I have pagination for a table to display data from the database in the table. This was working fine and I tried to add in a button which only admin's can see. If the user is not an admin they will not see this button. This feature works but once I did it, the pagination only shows one row of data compared to the maximum of 10 per page.</p>
  
  <p>This is my code:</p>
  
  <pre><code>         public function dataview($query)
   {
       $stmt = $this-&gt;db-&gt;prepare($query);
       $stmt-&gt;execute();
  
       if($stmt-&gt;rowCount()&gt;0) // display records if there are records to display
       {
              while($row=$stmt-&gt;fetch(PDO::FETCH_ASSOC))
              {
                  $poll_id = $row['poll_id'];
                  $question = $row['question'];
                 ?&gt;
                 &lt;tr&gt;
                 &lt;td&gt;&lt;?php echo $row['poll_id']; ?&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;?php echo $row['question']; ?&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;a href="openPoll.php?poll_id=&lt;?php echo $poll_id; ?&gt;"&gt;Open Poll&lt;/a&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;a href="openResults.php?poll_id=&lt;?php echo $poll_id; ?&gt;"&gt;Results&lt;/a&gt;&lt;/td&gt;
                 &lt;?php
                       $stmt = $this-&gt;db-&gt;prepare("SELECT * FROM users WHERE user_id=:user_id");
                       $stmt-&gt;execute(array(':user_id'=&gt;$_SESSION['user_session']));
                       $userRow=$stmt-&gt;fetch(PDO::FETCH_ASSOC);
                       if($stmt-&gt;rowCount() &gt; 0){
                       $admin = $userRow['admin'];
                       if($admin == 1){
                 ?&gt;
                 &lt;td&gt;&lt;a href="deletePoll.php?poll_id=&lt;?php echo $poll_id; ?&gt;"&gt;Delete Poll&lt;/a&gt;&lt;/td&gt;
                 &lt;?php
  
                 ?&gt;
  
                 &lt;/tr&gt;
  
                 &lt;?php
                       }
                       }
              }
       }
       else
       {
              ?&gt;
              &lt;tr&gt;
              &lt;td&gt;Nothing here...&lt;/td&gt;
              &lt;/tr&gt;
              &lt;?php
       }
  </code></pre>
  
  <p>}</p>
  
  <p>and this is the code on the html page which uses the pagination </p>
  
  <pre><code>    &lt;table align="center" border="1" width="100%" height="100%" id="data"&gt;
              &lt;?php 
              $query = "SELECT * FROM polls";       
              $records_per_page=10;
              $newquery = $paginate-&gt;paging($query,$records_per_page);
              $paginate-&gt;dataview($newquery);
              $paginate-&gt;paginglink($query,$records_per_page);  
              ?&gt;
              &lt;/table&gt;
  </code></pre>