Advertisement
asimryu

list.php

Aug 23rd, 2017
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. include("dbcon.php");
  3. $page=0;
  4. if( isset($_GET['page'])){
  5. $page =(int)$_GET['page'];
  6. }
  7. if( ! $page) $page=1;
  8. $start = ($page -1) * 10;
  9.  
  10. $sql = "select * from posts order by created_at DESC limit {$start},10";
  11. $rs = $db->query($sql);
  12. $data = $rs->fetchAll();
  13. foreach($data as $row):
  14. ?>
  15.  
  16. <tr>
  17. <td><?php echo $row['id'];?></td>
  18. <td><?php echo $row['title'];?></td>
  19. <td><?php echo $row['writer'];?></td>
  20. <td><?php echo $row['created_at'];?></td>
  21. <td><?php echo $row['hit'];?></td>
  22. <td>
  23. <a href="<?php echo $row['id'];?>" class="view-data">
  24. <span class="glyphicon glyphicon-eye-open btn btn-warning"></span>
  25. </a>
  26. </td>
  27.  
  28. </tr>
  29.  
  30. <?php
  31. endforeach
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement