<?php
session_start();
require("dbconnect.php");
$menu=$_SESSION['menu'];
include $menu;
?>

<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 
$sql=mysqli_query($con,"SELECT  * from epiloges where metataksi <> '' and class='Β'");

echo "<br>";
echo "ΕΞΕΤΑΣΕΙΣ ΜΕΤΑΤΑΞΗΣ";
echo "<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:16px'  >
<tr>
<th>A/A</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΗΤΡΩΟ</th>
<th>ΟΝΟΜΑ</th>
<th>ΟΜΠ</th>
<th>ΚΑΤ/ΣΗ</th>
<th>ΜΑΘΗΜΑ 1</th>
<th>ΜΑΘΗΜΑ 2</th>
</tr>";	
$k=1;
$row=mysqli_fetch_array($sql);
$mitroo=$row['mitroo'];
while (!empty($row))
{
   $mitroo=$row['mitroo'];
   $sqlo=mysqli_query($con,"select eponimo,onoma,tmima from allstudentinfo where mitroo='$mitroo'");
   $rowo=mysqli_fetch_array($sqlo);
   $tmima=ltrim(rtrim($rowo['tmima']));
   $name=$rowo['eponimo']." ".$rowo['onoma'];
   $omp=$row['omp'];
   $kat=$row['kat'];
   echo "<tr>";
   echo "<td>". $k. "</td>";
   echo "<td>".$tmima. "</td>";
   echo "<td>".$mitroo. "</td>";
   echo "<td>".$name. "</td>"; 
   echo "<td>". $omp. "</td>";
   echo "<td>". $kat. "</td>";
   
   $i=1;$math=array();  
   while ($mitroo==$row['mitroo'])
     {
       $math[$i]=$row['metataksi'];
       $i++;
       $row=mysqli_fetch_array($sql);	   
     } 
   echo "<td>". $math[1]. "</td>";
   echo "<td>". $math[2]. "</td>";   
   echo "</tr>";
   $k++;
}
echo "</table>"	;

$sql=mysqli_query($con,"SELECT metataksi,count(metataksi) as c from epiloges where metataksi <> '' and class='Β' group by metataksi");
echo "<br>";
echo "ΜΑΘΗΜΑΤΑ ΜΕΤΑΤΑΞΗΣ";
echo "<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:16px'  >
<tr>
<th>A/A</th>
<th>ΜΑΘΗΜΑ</th>
<th>ΣΥΝΟΛΟ ΜΑΘ.</th>
</tr>";	
$k=1;
while ($row=mysqli_fetch_array($sql))
{
   echo "<tr>";
   echo "<td>".$k;
   echo "<td>". $row['metataksi']. "</td>";
   echo "<td>". $row['c']. "</td>";   
   echo "</tr>";
   $k++;
}
echo "</table>"	;	
?>	
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>

</body>
</html>