php - How to give pagination - First, Last, Next & previous navigation -


i working on websites pagination , using following code.

<tr>     <td class="nex_pre" colspan="3"> <?php         $query="select * prosummary";         $query="select * prosummary";         $result=mysqli_query($connect,$query);         $count=mysqli_num_rows($result);         $pages=ceil($count/10);         for($i=1;$i<=$pages;$i++) { ?>         <a href="productmanager.php?p=<?php echo $i; ?>">         <?php echo $i;?></a>         <?php } ?>     </td> </tr> 

output showing :-

1 2 3 4 5  

but wanna show output :-

[first] [1] [2] [3] [4] [5] . . . . [10] [11] [12] [13] [14] [last] 

just concat $i whatever string need:

something like:

 <a href="productmanager.php?p=<?php echo $i; ?>">                 <?php echo $i==1 ? "[first]" : $i==$pages ? "[last]" : "[".$i."]";?></a>                 <?php } ?> 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -