<?php
include "scrinit.php";
include $menu;
?><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:12px; }
<p style="font-size:10px;"></p>
</style>

<h3>ΙΣΤΟΡΙΚΟ ΕΠΙΚΟΙΝΩΝΙΑΣ ΜΕ ΣΠΙΤΙ </h3>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];

$sql = mysqli_query($con,"SELECT s.*,m.datetm,al.tmima,al.mitroo,al.eponimo,al.onoma 
		FROM smsoutmes as s,smsout as m,allstudentinfo as al
		WHERE s.source='home' and s.senderpmp='$usr' and s.smscode=m.smscode and m.tel=al.kinito 
		order by m.datetm,al.tmima,al.eponimo,al.onoma" );
$c=mysqli_num_rows($sql);

if ($c==0)
{ 
  echo "<p>";
  echo " ΔΕΝ ΥΠΑΡΧEI ΣΧΕΤΙΚΗ ΕΠΙΚΟΙΝΩΝΙΑ ";
  echo "</p>";
}
else
{
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:9px'  >
<th>Ημερομ.</th>
<th>Μητρώο</th>
<th>Τμήμα</th>
<th>Μαθητής/τρια</th>
<th>Μήνυμα</th>";	

while ($row = mysqli_fetch_array($sql)) 
{
	
	$mitroo=$row['mitroo'];
	$datetime= $row['datetm'];	
	$name= $row['eponimo']." ".$row['onoma'];
	$mesg= $row['mes'];

	echo "<tr>";
	echo "<td>". date('d-m-Y', strtotime($datetime)) . "</td>";
	echo "<td>". $mitroo . "</td>";
	echo "<td>". $row['tmima'];"</td>";
		echo "<td>". $name. "</td>";
	echo "<td>". $mesg ." "."περ.". "</td>";
	echo "</tr>"; 
}
echo "</table>";
echo "<br>"."<br>";	
}
 ?>

<br /><br /><br /><br />

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