<?php 
session_start();
$menu=$_SESSION['menu'];
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>
<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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<?php 

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

$k=1;
while(!empty($row)) {
	$j=1;
    while($j<=7){$per1[$j]=0;$j++;}
	  $hmera=$row['dateout'];
      while ($hmera==$row['dateout']){
	     $per1[$row['period']]=$row['kath'];
	     $row = mysqli_fetch_array($sql);
		 }
     $i=1;
     echo "<td>" .$k."</td>";
     echo "<td>". $hmera . "</td>";
     while($i<=7){
		 echo "<td>". $per1[$i] . "</td>";$i++;}
     echo "</tr>";
     $k++;
}
echo "</table>";	 
}
$_SESSION['studentid']=$mitroo;
 ?>
<br /><br />
<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>