<?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");
$synd=trim($_GET['syndx']);
echo "<br>";
echo "<font face='arial' size='4pt'>TMHMA / ΣΥΝΔΙΔΑΣΚΑΛΙΑ : $synd </font> "; 
echo "<br>";


$result = mysqli_query($con,"SELECT mitroo,eponimo,onoma,tmima,kmathiti,kmiteras,kpatera,kinito FROM allstudentinfo 
WHERE tmima='$synd' ORDER BY eponimo,onoma");
if(mysqli_num_rows($result) > 0)
{
$cr=0;
	while($row=mysqli_fetch_array($result))
	{	
		$cr++;
		$mt[$cr]=$row['mitroo'];
	    $epo[$cr]=$row['eponimo']." ".$row['onoma'];	
		$tmim[$cr]=$row['tmima'];
		$kinitom[$cr]=$row['kmathiti'];
		$kinitomit[$cr]=$row['kmiteras'];
		$kinitop[$cr]=$row['kpatera'];
		$kinitos[$cr]=$row['kinito'];
	}	
}	
else
{	
	
$result = mysqli_query($con,"SELECT  s.mitroo FROM syndidaskalies as s,syndcodes as sc 
          WHERE sc.synd='$synd' and sc.syndid = s.syndid ORDER BY s.mitroo");	

$cr=0;
	while($row=mysqli_fetch_array($result))
	{	
		$cr++;
		$mt[$cr]=$row['mitroo'];
		$res = mysqli_query($con,"SELECT eponimo,onoma,tmima,kmathiti,kmiteras,kpatera,kinito FROM allstudentinfo 
				WHERE mitroo='$mt[$cr]' ");
		$rows=mysqli_fetch_array($res);	
	    $epo[$cr]=$rows['eponimo']." ".$rows['onoma'];	
		$tmim[$cr]=$rows['tmima'];
		$kinitom[$cr]=$rows['kmathiti'];
		$kinitomit[$cr]=$rows['kmiteras'];
		$kinitop[$cr]=$rows['kpatera'];
		$kinitos[$cr]=$rows['kinito'];
	}
}
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>
<th>Τηλ Πατέρα</th>
<th>Τηλ ΣΜΣ</th>";

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

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