Guest User

Untitled

a guest
Jan 12th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <style>
  2. a {color:red;}
  3. strong a {color:#666;}
  4. </style>
  5. <?php
  6. include 'kobling.php';
  7. $per_page = 1;
  8.  
  9. $pages_query = mysql_query("SELECT COUNT(`id`) FROM `bilder`");
  10. $pages = ceil(mysql_result($pages_query, 0) / $per_page);
  11.  
  12. $page = (isset($_GET['bilde'])) ? (int)$_GET['bilde'] : 1;
  13. $start = ($page - 1) * $per_page;
  14.  
  15. $query = mysql_query("SELECT `bilde` FROM `bilder` ORDER BY id DESC LIMIT $start, $per_page");
  16. while($query_row = mysql_fetch_assoc($query)){
  17.     echo $query_row['bilde'].'<br/>';
  18. }
  19.  
  20. if($pages >= 1 && $page <= $pages){
  21.     for($x = 1; $x<=$pages; $x++){
  22.         echo ($x == $page) ? '<strong><a href="?bilde='.$x.'">'.$x.'</a></strong> ' : '<a href="?bilde='.$x.'">'.$x.'</a> ';
  23.     }
  24. }
  25. else {
  26.     echo '404! Y U NO FOUND?';
  27. }
  28.  
  29. ?>
Add Comment
Please, Sign In to add comment