Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. include ('adm/connectdb.php');
  4. $num = 8;
  5. if (isset($_POST['search'])) {
  6.  
  7. $page = $_GET['page'];
  8. $result = mysql_query("SELECT COUNT(*) FROM `db1` WHERE `name`LIKE "%$search%"");
  9. $posts = mysql_result($result, 0);
  10. $total = intval(($posts - 1) / $num) + 1;
  11. $page = intval($page);
  12. if(empty($page) or $page < 0) $page = 1;
  13. if($page > $total) $page = $total;
  14. $start = $page * $num - $num;
  15. $result = mysql_query("SELECT * FROM `db1` WHERE `name`LIKE "%$search%" LIMIT $start, $num");
  16. while ( $postrow[] = mysql_fetch_array($result))
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement