<?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>ΣΕΜΙΝΑΡΙΟ</th>
<th>ΑΡΙΘΜΟΣ ΜΑΘ</th>";
$sql= mysqli_query($con,"SELECT COUNT(d.semcode) as nsem,s.semname,s.semcode from seminaria as s,dilosisem as d
					where s.semcode=d.semcode group by semcode order by semcode");
$k=1;
while ($row = mysqli_fetch_array($sql)) 
{
	$code=$row['semcode'];
	$semname=$row['semname'];
	echo "<tr>";
	echo "<td>".$code."</td>";
	echo "<td>".$semname."</td>";
	echo "<td>".$row['nsem']."</td>";
	}
echo "</table>";
//////////////////////////////////////////

echo "<br>";echo "<br>";
echo "ΔΕΝ ΔΗΛΩΣΑΝ "."<br>";
$result = mysqli_query($con,"SELECT  DISTINCT d.mitroo FROM dilosisem 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 where tmima like 'Α%' 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>