<?php
session_start();
$menu=$_SESSION['menu'];
include "logo.php";
?>
<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:14px; }
<p style="font-size:14px;"></p>
</style>
</head>

<body>

<?php
require "dbconnect.php";
$m=explode("/",$_GET['data']);
$mitroo=$m[0];
$mx=$m[1];
$sql = mysqli_query($con,"SELECT dateout, period FROM apousies WHERE mitroo='$mitroo' AND apousia=1  ORDER BY dateout,period " );
$row = mysqli_fetch_array($sql);
	
// Print out result
echo "<br>"."<br>";
echo "ΑΝΑΛΥΤΙΚΗ ΚΑΤΑΣΤΑΣΗ ΑΠΟΥΣΙΩΝ"."<br>";
echo "<table style='width:400px' class='myTable' >
<tr style='border:1px solid black' bgcolor='#66CC99' >
<th>Ημερομηνία</th>
<th>Περ1</th>
<th>Περ2</th>
<th>Περ3</th>
<th>Περ4</th>
<th>Περ5</th>
<th>Περ6</th>
<th>Περ7</th>
</tr>";	

while(!empty($row)) {
	$j=1;
    while($j<=7){$per1[$j]="  ";$j++;}
	  $dt=$row['dateout'];
	  echo "<td>". $dt . "</td>";
	   	 
	  while ($dt==$row['dateout']){
	  $per1[$row['period']]="?";
	  $row = mysqli_fetch_array($sql);}
    

     $i=1;    
     while($i<=7){
		 echo "<td><b>". $per1[$i] . "</b></td>";$i++;}
     echo "</tr>";
   
}
echo "</table>";	
$_SESSION['studentid']=$mitroo;
 ?>
<br /><br /><br />
<?php
if ($mx==1)
{
	?><a  href="kartela1.php?xn=1" style="color:blue "  > <button> Επιστροφή    </a><?php
}
else
{
	?><a  href="kartelan.php" style="color:blue "  > <button> Επιστροφή    </a>	<?php
}
?>
</body>
</html>