<?php
include "scrinit.php";
include "logo.php";
?>


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:5px;font-size:14px; }
<p style="font-size:14px;"></p>
</style>


</head>

<body>
<?php
require("dbconnect.php");
$syndx=$_GET['syndx'];
$ar=explode("/",$syndx);
$synd=$ar[0];
$syndid=$ar[1];
echo "<br>";
echo "<font face='arial' size='4pt'>TMHMA / ΣΥΝΔΙΔΑΣΚΑΛΙΑ : $synd </font> "; 
echo "<br>";


$result = mysqli_query($con,"SELECT  DISTINCT mitroo,eponimo,onoma,tmima,kmathiti FROM allstudentinfo 
WHERE tmima='$synd' ORDER BY eponimo,onoma");
if(mysqli_num_rows($result) == 0)
{
$result = mysqli_query($con,"SELECT  DISTINCT s.mitroo,a.eponimo,a.onoma,a.tmima,a.kmathiti 
FROM syndidaskalies as s,allstudentinfo as a,syndcodes as sc 
WHERE s.syndid = sc.syndid AND s.mitroo=a.mitroo and sc.synd='$synd' ORDER BY a.eponimo,a.onoma");	
}
$crow1=mysqli_num_rows($result);
$cr=1;
	while($row=mysqli_fetch_array($result))
	{	
		$mt[$cr]=$row['mitroo'];
	    $epo[$cr]=$row['eponimo']." ".$row['onoma'];	
		$tmim[$cr]=$row['tmima'];
		$kinito[$cr]=$row['kmathiti'];
		$cr++;
	}
print_r($epo);
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:14px'  >
<th>α/α</th>
<th>Α.Μ</th>
<th>Τμήμα</th>
<th>Όνοματεπώνυμο</th>
<th>Απουσία</th>
<th>Καθυστ.</th>";

$i=1;
while($i<=$crow1)
{
	 echo "<tr>";
	 echo "<td>" .$i."</td>";
	 echo "<td>". $mt[$i]. "</td>";
	 echo "<td>". $tmim[$i]. "</td>";
	 echo "<td>". $epo[$i] . "</td>";
	 echo "<td>". "  " ."</td>";
	 echo "<td>". "  " ."</td>";
	 echo "</tr>";
     $i++;
}

echo "</table>";
?>
<br><br>
<button onClick="window.print()">	Εκτύπωση Σελίδας</button>
<input type="button" name="epistrofi" value="Επιστροφή" onClick="self.close()"> 		
</body>
</html>