<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
echo '<center>';
echo '<a href="http://kresosusec.com.hr">'.'Početna'.'</a>'.'<br>';
require 'konekcija.php';
if(isset($_GET['broj']))
{
$broj=$_GET['broj'];
$pocetno=($broj-1)*15;
$y=($broj-1)*15;
}
else
{
$broj=1;
$pocetno=0;
$y=0;
}
echo '<table border="2">';
echo '<tr><th>'.''.'<th>'.
'MBR'.'<th>'.
'Ime'.'<th>'.
'Prezime'.'<th>'.
'Prosjek'.'<tr>';
$query="select u.mbrStud,u.imeStud,u.prezStud,
round(avg(o.ocjena),2) as prosjek
from ucenici u
left outer join ocjene o
on u.mbrStud=o.mbrStud
group by u.mbrStud
limit $pocetno,15";
$result= mysqli_query($link, $query);
while($row= mysqli_fetch_assoc($result))
{
$prosjek='<a href="predmeti.php?mbr='.$row['mbrStud'].'&prosjek='.$row['prosjek'].'">'
.$row['prosjek'].'</a>';
$y=$y+1;
echo '<tr><td>'.$y.'<td>'.
$row['mbrStud'].'<td>'.
$row['imeStud'].'<td>'.
$row['prezStud'].'<td>'.
$prosjek.'<tr>';
}
echo '</table>';
$query2="select mbrStud from ucenici";
$result2= mysqli_query($link, $query2);
$numRows= mysqli_num_rows($result2);
$total=ceil($numRows/15);
if($broj>=$total)
{
echo '<a href="index.php">'.'Naprijed'.'</a>'.'<br>';
}
else
{
echo '<a href="index.php?broj='.($broj+1).'">'.'Naprijed'.'</a>'.'<br>';
}
for($x=1;$x<=$total;$x=$x+1)
{
echo '<a href="index.php?broj='.$x.'">'.$x.'</a>|';
}
if($broj<=1)
{
echo '<br>'.'<a href="index.php">'.'Natrag'.'</a>';
}
else
{
echo '<br>'.'<a href="index.php?broj='.($broj-1).'">'.'Natrag'.'</a>';
}
?>
</body>
</html>