<?php
include "scrinit.php";
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>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function popupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=900, top='+top+', left='+left);
}
</script>

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

<?php 
require("dbconnect.php");
$dt=$_SESSION['dt'];
$taxi='Γ';

$sql1=mysqli_query($con,"SELECT DISTINCT must1 AS cc FROM must union SELECT DISTINCT must2 AS cc FROM must union
SELECT DISTINCT must3 AS cc FROM must where must3 <> '' union select distinct epilogi as cc from epiloges where class='$taxi'");
$i=1;
while($row=mysqli_fetch_array($sql1))
{
	$math[$i]=$row['cc'];
	$i++;
}
//print_r($math);
$core=array_fill_keys($math,0);
//print_r($core);

$sql1=mysqli_query($con,"select e.mitroo,e.kat,m.* from epiloges as e,must as m where e.class='$taxi' and e.kat=m.kat group by e.mitroo" );
$i=1;$d=$kate=$el=array();
while($row=mysqli_fetch_array($sql1))
{
	$d[$i]=$row['mitroo'];
	
	$el[$i]=$row['electnum'];
	$kat1=$row['must1'];
	$core[$kat1]=$core[$kat1]+1;
	$kat2=$row['must2'];
	
	$core[$kat2]=$core[$kat2]+1;
	if ($el[$i] == 1) 
	{
		$kat3=$row['must3'];
		$core[$kat3]=$core[$kat3]+1;
	}
	//echo "<br>".$d[$i].$kat1.$kat2.$kat3.$el[$i];
	$i++;
}
echo "<br>";

$sql=  mysqli_query($con,"SELECT  epilogi,mitroo FROM epiloges WHERE class='$taxi' ");
$row=mysqli_fetch_array($sql);
while($row=mysqli_fetch_array($sql))
{
	$kat=$row['epilogi'];
	$core[$kat]=$core[$kat]+1;
}

//print_r($core);

echo "ΑΡΙΘΜΟΣ ΜΑΘΗΤΩΝ ΑΝΑ ΜΑΘΗΜΑ";
echo "<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:16px'  >
<tr>
<th>Α/Α</th>
<th>ΜΑΘΗΜΑ</th>
<th>ΑΡΙΘΜΟΣ</th>
</tr>";	
$i=1;
foreach(array_keys($core) as $math)
{
   if ($math <> "")
   {
      echo "<tr>";
      echo "<td>". $i. "</td>";
      echo "<td>". $math. "</td>";
      echo "<td>". $core[$math]. "</td>";
      echo "</tr>";
      $i++;
   }
}
echo "</table>"; 


?>	
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>

</body>
</html>