Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $showPage = 20;
- $pageNo = 1;
- if(isset($_GET['page']) && $_GET['page']!=1) {
- $pageNo=$_GET['page'];
- $up = $showPage;
- $low=$showPage*($_GET['page']-1);
- } else {
- $up = $showPage;
- $low=0;
- } //endif(isset($_GET['page'])
- $i=1;
- $sql2=("SELECT * FROM customers ORDER BY id DESC");
- $result2=mysql_query($sql2) or die (mysql_error());
- $count_row=mysql_num_rows($result2);//for pagination only
- $customerList = mysql_query("SELECT * FROM customers ORDER BY id DESC LIMIT $low,$up") or die(mysql_error());
- while( $customerArr = mysql_fetch_array($customerList) ) { ?>
- TABLE HERE
- <?php } //while( $customerArr = mysql_fetch_array($customerList) ?>
- <?php if($count_row!=""){ ?>
- <div class="paging">
- <?php if ($pageNo!=1){ ?>
- <span class="prev"><a rel="prev" href="accessories.php?page=<?php echo $_GET['page']-1;?>">« Previous</a></span>
- <?php } else { ?>
- <span class="disabled">« Previous</span>
- <?php } //endif ($pageNo!=1) ?>
- <?php
- $pageCount = ceil($count_row/$showPage);
- //echo $pageCount;
- for ($i=1;$i<=$pageCount;$i++){
- if ($i == $pageNo){
- echo "<span class=\"current\">"; echo $i; echo"</span>";
- } else { ?>
- <span><a href="add_customer.php?page=<?php echo $i; ?>"><?php echo $i; ?></a></span>
- <?php } //endif ($i == $pageNo)
- } //end of for ($i=1;$i<=$pageCount;$i++) ?>
- <?php if ($pageCount!=$pageNo){ ?>
- <span class="next"><a rel="next" href="add_customer.php?page=<?php echo $pageNo+1; ?>">Next »</a></span>
- <?php } else {?>
- <span class="disabled">Next »</span>
- <?php } //if ($pageCount!=$pageNo) ?>
- </div> <!-- .paging -->
- <?php } //endif($count_row!="") ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement