<?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 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>".$omname."</td>";
	$sql1 = mysqli_query($con,"SELECT t.Name FROM teachers as t,dilosiomilos as d
						 where d.code1='$code' and d.PMP=t.PMP" );
	$c=mysqli_num_rows($sql1);
	for ($i=1;$i<=$c;$i++)
	{
		$row1 = mysqli_fetch_array($sql1);
	    $omilos[$code]=$omilos[$code].", ".$row1['Name'];
	}
	
	echo "<td>".ltrim($omilos[$code],",")."</td>";
	echo "</tr>";
	$k++;
}
echo "</table>";

?>
<br><br>
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>

</body>
</html>