sueckreimir

prosjek/index

Sep 25th, 2019 (edited)
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.68 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.        
  15.         echo '<center>';
  16.         echo '<a href="http://kresosusec.com.hr">'.'Početna'.'</a>'.'<br>';
  17.        
  18.         require 'konekcija.php';
  19.        
  20.         if(isset($_GET['broj']))
  21.         {
  22.             $broj=$_GET['broj'];
  23.             $pocetno=($broj-1)*15;
  24.             $y=($broj-1)*15;
  25.         }
  26.         else
  27.         {
  28.             $broj=1;
  29.             $pocetno=0;
  30.             $y=0;
  31.         }
  32.        
  33.         echo '<table border="2">';
  34.         echo '<tr><th>'.''.'<th>'.
  35.                      'MBR'.'<th>'.
  36.                      'Ime'.'<th>'.
  37.                  'Prezime'.'<th>'.
  38.                  'Prosjek'.'<tr>';
  39.        
  40.         $query="select u.mbrStud,u.imeStud,u.prezStud,
  41.        round(avg(o.ocjena),2) as prosjek
  42.        from ucenici u
  43.             left outer join ocjene o
  44.             on u.mbrStud=o.mbrStud
  45.        group by u.mbrStud
  46.        limit $pocetno,15";
  47.         $result= mysqli_query($link, $query);
  48.        
  49.        
  50.         while($row= mysqli_fetch_assoc($result))
  51.         {
  52.             $prosjek='<a href="predmeti.php?mbr='.$row['mbrStud'].'&prosjek='.$row['prosjek'].'">'
  53.             .$row['prosjek'].'</a>';
  54.            
  55.            
  56.             $y=$y+1;
  57.             echo '<tr><td>'.$y.'<td>'.
  58.                             $row['mbrStud'].'<td>'.
  59.                             $row['imeStud'].'<td>'.
  60.                             $row['prezStud'].'<td>'.
  61.                             $prosjek.'<tr>';
  62.                            
  63.         }
  64.         echo '</table>';
  65.        
  66.         $query2="select mbrStud from ucenici";
  67.         $result2= mysqli_query($link, $query2);
  68.         $numRows= mysqli_num_rows($result2);
  69.         $total=ceil($numRows/15);
  70.        
  71.         if($broj>=$total)
  72.         {
  73.              echo '<a href="index.php">'.'Naprijed'.'</a>'.'<br>';
  74.         }
  75.         else
  76.         {
  77.              echo '<a href="index.php?broj='.($broj+1).'">'.'Naprijed'.'</a>'.'<br>';
  78.         }
  79.        
  80.         for($x=1;$x<=$total;$x=$x+1)
  81.         {
  82.             echo '<a href="index.php?broj='.$x.'">'.$x.'</a>|';
  83.         }
  84.        
  85.         if($broj<=1)
  86.         {
  87.             echo '<br>'.'<a href="index.php">'.'Natrag'.'</a>';
  88.         }
  89.         else
  90.         {
  91.             echo '<br>'.'<a href="index.php?broj='.($broj-1).'">'.'Natrag'.'</a>';
  92.         }
  93.        
  94.        
  95.        
  96.         ?>
  97.     </body>
  98. </html>
Add Comment
Please, Sign In to add comment