<?php
include "scrinit.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:11px; }
<p style="font-size:09px;"></p>
</style>
<body>


<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];
$dt=$_SESSION['dt']; 
$date=$dt;

$sql = mysqli_query($con,"SELECT PMP FROM teachers WHERE idikotita='ΠΛΗΡΟΦΟΡΙΚΗ'"); 
$i=1;
$pl=array();
while ($row = mysqli_fetch_array($sql)) 
{
		$pl[$i]=$row['PMP'];
		$i++;
}
if (in_array($usr, $pl))
{
	$sqlx = mysqli_query($con,"SELECT pmp FROM ipefthinotites WHERE code=1 or code=3");
	$rowx = mysqli_fetch_array($sqlx);
	$usr=$rowx['pmp'];
}
if (!mysqli_query($con,$sql1)) {die('Πρόβλημα: ' . mysqli_error($con));   }
$res=mysqli_query($con,$sql1);
$c=mysqli_num_rows($res);
$sql1 = "SELECT * FROM epidiorthosi WHERE status <> '1' and 
(select pmp from ipefthinotites where code=problemwith) = '$usr' order by datein asc " ;

if (!mysqli_query($con,$sql1)) {die('Πρόβλημα: ' . mysqli_error($con));   }
$res=mysqli_query($con,$sql1);
$c=mysqli_num_rows($res);

if ($c <>0 )
{
?>
<h3>ΕΠΙΣΚΟΠΗΣΗ ΑΝΑΦΟΡΩΝ ΓΙΑ ΠΡΟΒΛΗΜΑΤΑ </h3>	
<?php
echo "<table  class='myTable' >
<tr style='border:1px solid black' bgcolor='#ffcc00'  >
<th>Κωδ.</th>
<th>Ημερ.Κατ</th>
<th>Εκπαιδευτικός</th>
<th>Αίθουσα</th>
<th>Περιγραφή</th>
</tr>";	

while ($row = mysqli_fetch_array($res)) 
{
	$code=$row['id'];
	$pmp=$row['pmp'];
	$perigrafi=$row['perigrafi'];
	$datein=$row['datein'];
	$room=$row['room'];
	$sqlx=mysqli_query($con,"SELECT Name  FROM teachers  WHERE  PMP='$pmp' " );
    $row2 = mysqli_fetch_array($sqlx);
    $tname=$row2['Name'];
	
echo "<tr>";
echo "<td>" .  "<a href=\"fixsubmit2.php?data=".$code."\">"."<b>".$code."</b>". "</a>". "</td>";
echo "<td>" . $datein. "</td>";
echo "<td>" . $tname. "</td>";
echo "<td>" . $room. "</td>";
echo "<td>" . $perigrafi. "</td>";
echo "</tr>"; 
}
echo "</table>";

}
 ?>
</body>
</html>