<?php
include "scrinit.php";
include "logo.php";

?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>


<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:11px;"></p>
</style>

<body>
<?php

require("dbconnect.php");

$dt=$_SESSION['dt'];
$name = $_SESSION['n'];



if ($_POST['submita'])
{
  $code=$_POST['code'];
   
  $sqld = mysqli_query($con,"DELETE FROM timoria WHERE timoriacode='$code'");
  mysqli_query($con,"UPDATE apousies SET timoriacode=0 WHERE timoriacode='$code'");
  echo "Οι καΘυστερήσεις έχουν ανακληθεί";  
  
  $sql = $dbcon->prepare("SELECT * FROM apobolientypo WHERE timocode = ? ");
  $sql->execute([$code]);
  $row=$sql->fetch(PDO::FETCH_ASSOC);
  $count=$sql->rowCount();
  $entipo=$row['entypoid'];
  $mitroo=$row['mitroo'];
  $datet=$row['date'];
  if ($count > 0)
  {
    mysqli_query($con,"DELETE FROM apobolientypo WHERE timocode='$code' ");
	echo "<br>"."Έντυπο Αποβολής - ΟΚ";
	mysqli_query($con,"DELETE FROM apoboli WHERE entypoid='$entipo' ");
	echo "<br>"." Μαθήματα Αποβολής - ΟΚ";
	$sql = $dbcon->prepare("SELECT code FROM ekdilosi WHERE katacode = ? ");
	$sql->execute([$code]);
	$count=$sql->rowCount();
	while ($row=$sql->fetch(PDO::FETCH_ASSOC))
	{
		$codex=$row['code'];
		mysqli_query($con,"DELETE FROM ekdilosistu WHERE code='$codex' and pmp='$mitroo' ");
	}

	mysqli_query($con,"DELETE FROM ekdilosi WHERE katacode='$code' ");
	echo "<br>"." Εγγραφή στις Εκδηλώσεις - ΟΚ";

}
else
{
   echo "Δεν έγινε οποιαδήποτε ενέργεια!";
}  
}
?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "><button>Επιστροφή στο Μενού</button></a>&nbsp&nbsp 
<a  href="kathisterisi.php" style="color:blue "><button>Λίστα Καθυστερήσεων</button>  </a>
</body>
</html>