<?php
session_start(); // start up your PHP session!
 if ($_SESSION['islogin']=='' ) { 
  echo "ΠΡΕΠΕΙ ΝΑ ΚΑΝΕΤΕ ΕΓΓΡΑΦΗ ΓΙΑ ΧΡΗΣΗΣ ΤΟΥ ΣΥΣΤΗΜΑΤΟΣ"."<BR>";
  sleep(3);
  header("Location: loginall.php"); /* Redirect browser */
  exit();
  }
$menu=$_SESSION['menu'];
include "logo.php";
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:11px; }
<p style="font-size:11px;"></p>
</style>


</head>
<body  style="width:995px; margin:0 auto; ">

<?php 
require("dbconnect.php");
echo "<br>"."<br>";
$_SESSION['tax']='Β';
$sqle=  mysqli_query($con,"SELECT  kat,name from kats order by kat");
$k=mysqli_num_rows($sqle);

while ($rowe=mysqli_fetch_array($sqle))
{
$kat=$rowe['kat'];
$epilogi=$rowe['name'];
echo "<br>";echo "<br>";
echo "ΚΑΤΕΥΘΥΝΣΗ : ". "<b>".$kat." - ".$epilogi."</b>";
echo "<br>";
$sqlk=  mysqli_query($con,"SELECT distinct mitroo from epiloges where kat='$kat' and class='Β'");
$kn=mysqli_num_rows($sqlk);
echo "ΑΡΙΘΜΟΣ ΜΑΘΗΤΩΝ : "."<b>".$kn."</b>";echo "<br>";


$sql=  mysqli_query($con,"SELECT  epilogi,count(epilogi) AS ep from epiloges where kat='$kat' and epilogi <> '' and class='Β' group by epilogi");
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:16px'  >
<tr>
<th>Α/Α</th>
<th>ΜΑΘΗΜΑ ΕΠΙΛΟΓΗΣ</th>
<th>ΑΡΙΘΜΟΣ</th>
</tr>";
$i=1;	
while($row = mysqli_fetch_array($sql))
{
   echo "<tr>";
   echo "<td>". $i. "</td>";
   echo "<td>". $row['epilogi']."</td>";
   echo "<td>". $row['ep'] . "</td>";
   echo "</tr>";
   $i++;
}
echo "</table>"; 
}
echo "<br>"."<br>";
$result = mysqli_query($con,"SELECT  count(DISTINCT(mitroo)) as stus FROM epiloges where class='Β' " );
$row=mysqli_fetch_array($result);

echo "<br>"."ΣΥΝΟΛΟ ΜΑΘΗΤΩΝ : ".$row['stus'];
//***********************
echo "<br>"."<br>";
?>	
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>

</body>
</html>