<?php
include "scrinit.php";
include "logo.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style type="text/css">
input.right{  text-align:right;  }
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:10pt; }
</style>
<body>

<?php
require "dbconnect.php";
$dt=date('Y-m-d');
 
echo "<b>"." ΚΑΤΑΛΟΓΟΣ ΣΥΜΜΕΤΟΧΗΣ ΣΕ ΟΜΙΛΟΥΣ "."</b>"."<br>";
// Start while loop to get data
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>ΚΩΔΙΚ</th>
<th colspan='6' >ΟΜΙΛΟΣ</th>";
$sql= mysqli_query($con,"SELECT code,omilos,perigrafi from omiloi order by code");
$k=1;
while ($row = mysqli_fetch_array($sql)) 
{
	$code=$row['code'];
	$omname=$row['omilos'];
	echo "<tr>";
	echo "<td>".$code."</td>";
	echo "<td colspan='5'>".$omname."</td>";
	echo "<tr>"."</tr>";
	$sql1 = mysqli_query($con,"SELECT al.eponimo,al.onoma,al.mitroo,al.tmima FROM allstudentinfo as al,dilosiomilosstu as d
						 where d.code='$code' and d.mitroo=al.mitroo" );
	$c=mysqli_num_rows($sql1);
	for ($i=1;$i<=$c;$i++)
	{
		$row1 = mysqli_fetch_array($sql1);
		$omilos[$code][$i]=$row1['mitroo'];
		echo "<td>";
		echo "<td >".$i."</td>";
		echo "<td >".$row1['mitroo']."</td>";
		echo "<td >".$row1['tmima']."</td>";
		echo "<td >".$row1['eponimo']." ".$row1['onoma']."</td>";
		echo "</tr>";
		$k++;
	}
	
}
echo "</table>";
//////////////////////////////////////////

echo "<br>";echo "<br>";
echo "ΔΕΝ ΔΗΛΩΣΑΝ "."<br>";
$result = mysqli_query($con,"SELECT  DISTINCT d.mitroo FROM dilosiomilosstu as d,allstudentinfo as al 
where al.mitroo=d.mitroo order by al.tmima " );
$i=1;
while($row=mysqli_fetch_array($result)) {$d[$i]=$row['mitroo'];$i++;}

$result = mysqli_query($con,"SELECT  mitroo,onoma,eponimo,tmima FROM allstudentinfo  order by tmima" );
$i=1;
while($row=mysqli_fetch_array($result)) 
{
	$dal[$i]=$row['mitroo'];
	$name[$dal[$i]]=$row['eponimo']." ".$row['onoma'];
	$tmima[$dal[$i]]=$row['tmima'];
	$i++;}

$dif=array_diff($dal,$d);
$n=count($dif);
$i=1;
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>Α/Α</th>
<th>ΜΗΤΡΩΟ</th>
<th>ΤΜΗΜΑ</th>
<th>ΟΝΟΜΑ ΜΑΘ</th>";
foreach($dif as $x)
{  
	echo "<tr>";
	echo "<td>".$i."</td>";
	echo "<td>".$x."</td>";
	echo "<td>".$tmima[$x]."</td>";
	echo "<td>".$name[$x]."</td>";
	echo "</tr>";
	$i++;
}
echo "</table>";
?>
<br><br>
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>

</body>
</html>