sueckreimir

ucenici/index

Sep 25th, 2019 (edited)
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.29 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8.     <head>
  9.         <meta charset="UTF-8">
  10.         <title></title>
  11.     </head>
  12.     <body>
  13.         <?php
  14.          echo '<center>';
  15.         echo '<a href="http://kresosusec.com.hr">'.'Početna'.'</a>'.'<br>';
  16.        
  17.         require 'konekcija.php';
  18.        
  19.         if(isset($_GET['broj']))
  20.         {
  21.             $broj=$_GET['broj'];
  22.             $pocetno=($broj-1)*15;
  23.             $y=($broj-1)*15;
  24.         }
  25.         else
  26.         {
  27.             $broj=1;
  28.             $pocetno=0;
  29.             $y=0;
  30.         }
  31.        
  32.         echo '<table border="2">';
  33.         echo '<tr><th>'.' '.'<th>'.'Ime'.'<th>'.'Prezime'.'<th>'.'MBR'.'<tr>';
  34.        
  35.         $query="select imeStud,prezStud,mbrStud
  36.        from stud
  37.        limit $pocetno,15";
  38.         $result= mysqli_query($link, $query);
  39.        
  40.        
  41.         while($row= mysqli_fetch_assoc($result))
  42.         {
  43.             $mbr='<a href="uredi.php?mbr='.$row['mbrStud'].'&broj='.$broj.'">'
  44.             .$row['mbrStud'].'</a>';
  45.             $y=$y+1;
  46.             echo '<tr><td>'.$y.'<td>'.
  47.                             $row['imeStud'].'<td>'.
  48.                             $row['prezStud'].'<td>'.
  49.                             $mbr.'<tr>';
  50.         }
  51.         echo '</table>'.'<br>';
  52.        
  53.         $query2="select mbrStud from stud";
  54.         $result2= mysqli_query($link, $query2);
  55.         $numRows= mysqli_num_rows($result2);
  56.         $total=ceil($numRows/15);
  57.        
  58.         if($broj>=$total)
  59.         {
  60.             echo '<a href="index.php">'.'Naprijed'.'</a>'.'<br>';
  61.         }
  62.         else
  63.         {
  64.             echo '<a href="index.php?broj='.($broj+1).'">'.'Naprijed'.'</a>'.'<br>';
  65.         }
  66.        
  67.         for($x=1;$x<=$total;$x=$x+1)
  68.         {
  69.             echo '<a href="index.php?broj='.$x.'">'.$x.'</a>|';
  70.         }
  71.        
  72.         if($broj<=1)
  73.         {
  74.             echo '<br>'.'<a href="index.php">'.'Natrag'.'</a>';
  75.         }
  76.         else
  77.         {
  78.             echo '<br>'.'<a href="index.php?broj='.($broj-1).'">'.'Natrag'.'</a>';
  79.         }// put your code here
  80.         ?>
  81.        
  82.     </body>
  83. </html>
  84.  
Add Comment
Please, Sign In to add comment