title: pagination in php not working
body: <p>I am new to php. I have to display the records from mysql with pagination in php. In my code the records are fetching properly but pagination is not working.It is showing the page number if i click any page it shows the full record only.</p>
  
  <p><strong>display.php</strong> </p>
  
  <pre><code>&lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
  &lt;html&gt;
  
  &lt;body&gt;
  &lt;?php
      $conn = new mysqli("localhost:3306", "root", "", "task");
  
      if ($conn-&gt;connect_error) {
          die("Connection failed: " . $conn-&gt;connect_error);
      }
      $per_page= 30;
      $sql="SELECT * FROM data";
      $result= $conn-&gt;query($sql);
  
  
      if(isset($_GET['page']) &amp;&amp; is_numeric($_GET['page'])){
          $page=$_GET['page'];
      }
      else{
          $page = 1;
      }
      $start =($page - 1) * $per_page;
      $sql=$sql." LIMIT $start,$per_page";
      $query2 = $conn-&gt;query($sql);
  ?&gt;
  &lt;table class="table table-bordered table-striped"&gt;
  &lt;thead&gt;  
      &lt;tr&gt;  
      &lt;th&gt;Ticket ID&lt;/th&gt;  
      &lt;th&gt;Tocken Number&lt;/th&gt;
      &lt;th&gt;Status&lt;/th&gt;  
      &lt;/tr&gt;  
  &lt;thead&gt;  
  &lt;tbody&gt;  
  &lt;?php  
  while ($row = $result-&gt;fetch_assoc()) {  
  ?&gt;  
              &lt;tr&gt;  
              &lt;td&gt;&lt;?php echo $row["ticket_id"]; ?&gt;&lt;/td&gt;  
              &lt;td&gt;&lt;?php echo $row["tocken_no"]?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row["status"] ?&gt;&lt;/td&gt;   
              &lt;/tr&gt;  
  &lt;?php  
  };  
  ?&gt;  
  &lt;/tbody&gt;  
  &lt;/table&gt;  
  &lt;?php
  $row_cnt = $result-&gt;num_rows;
      $pages = ceil($row_cnt/$per_page);
  
  $page_link="&lt;div class='pagination'&gt;";
  
  for($i=1; $i&lt;=$pages; $i++)
  {
  $page_link .= "&lt;a href='display.php?page=".$i."'&gt;".$i."&lt;/a&gt;";  
  }
  echo $page_link . "&lt;/div&gt;";
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>