
	$row=$result->fetch(PDO::FETCH_ASSOC);
	$tmima=$row['Class_id'];
	$result = $dbcon->prepare("SELECT mitroo,eponimo,onoma FROM allstudentinfo WHERE tmima=? " ); 
	$result->execute([$tmima]);   
	echo "TMHMA : ".$tmima."<br>"."<br>";
	echo "<table class='myTable' >
	<tr style='border:2px solid black' >
	</tr>";
	echo "<tr > 
	<th>Α/Α</th>
	<th>Μητρώο</th>
	<th>Ονοματεπώνυμο Μαθητή/τριας</th>
	<th>Σύνολο Μονάδων</th>
	</tr>";

	$i=1;
	 while($row=$result->fetch(PDO::FETCH_ASSOC))
		 {
		   $mitroo[$i]=$row['mitroo'];
		   $res1 = $dbcon->prepare("SELECT * FROM ddk WHERE mitroo=? ");
		   $res1->execute([$mitroo[$i]]);
		   $row1=$res1->fetch(PDO::FETCH_ASSOC); 
		   $n=$res1->columnCount()-1;
		   $sum=0;
		   for ($j=1;$j<=$n;$j++)
			  {	
				 $field="f".$j;
				 $sum=$sum+$row1["$field"];
			  }
		  $name[$i]=$row['eponimo']." ".$row['onoma'];
		  echo "<td>" . $i. "</td>";
		  echo "<td>" . $mitroo[$i]. "</td>";
		 ?>
		 <td>
	   <a href='ddkbathmos.php?mitr=<?php echo $mitroo[$i]; ?>')"><?php echo $name[$i]; ?></a>
		</td>
	<?php

		  echo "<td>" . $sum. "</td>";
		  echo "</tr>";
		  $i++;
     }
	}
echo "</table>"; 