Advertisement
sygi

Untitled

Feb 7th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?php
  2.  
  3.     require_once("connect.php");
  4.  
  5.     $zapytanie = mysqli_query($link, "SELECT * FROM buty");
  6.     $num_rows = mysqli_num_rows($zapytanie);
  7.     $produkty_ns = 3;
  8.     $numer = ceil($num_rows/$produkty_ns); // 12 to ilość produktów na stronie, a samo numer liczy ila ma być stron
  9.  
  10.     $adres = "/sklep2/text.php/current="; // adres przez ktory bedzie przechwytywana bedzie wartosc po current
  11.     $adres2 = $_SERVER['REQUEST_URI']; // adres po hoscie np. facebook.pl/aaa to wyswietli /aaa
  12.  
  13.     $dl_b = strlen($adres); // dlugosc $adres
  14.     $dl_a = $dl_b - strlen($adres2);
  15.     $wytnij = substr($adres2, $dl_a); // odejmowanie stringów
  16.     $numer_stron = intval($wytnij); // numer po current
  17.  
  18.     if($_SERVER['REQUEST_URI']=="/sklep2/text.php?current=".$numer_stron."" && $numer_stron<=$numer)
  19.     {
  20.         for($licznik=$numer_stron*$produkty_ns-($produkty_ns - 1); $licznik<=$produkty_ns*$numer_stron; $licznik++)
  21.         {
  22.             echo $licznik." ";
  23.            
  24.         }
  25.         echo "<br/>";
  26.         for($i=1; $i<=$numer; $i++)
  27.         {
  28.            
  29.             echo "<a href='/sklep2/text.php?current=".$i."'>".$i."</a>";
  30.         }
  31.     }
  32.     else
  33.     {
  34.         echo "Taka strona nie istnieje";
  35.     }
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement