<?php
	header("Content-Type: application/xls");    
	header("Content-Disposition: attachment; filename=file.xls");  
	header("Pragma: no-cache"); 
	header("Expires: 0");

    include_once("db_connect.php"); 
	
	$output = "";
	
	$output .="
		<table>
			<thead>
				<tr>
					<th>N° d'inscription</th>
					<th>Nom</th>
					<th>Prenom</th>
					<th>EMD1</th>
					<th>EMD2</th>
					<th>TD</th>
					<th>TP</th>
					<th>SYN</th>
					<th>RATT</th>
					<th>Moyenne</th>
				</tr>
			<tbody>
	";
	
	$query = $conn->query("SELECT * FROM `student`") or die(mysqli_errno());
	while($fetch = $query->fetch_array()){
		
	$output .= "
				<tr>
					<td>".$fetch['stud_id']."</td>
					<td>".$fetch['firstname']."</td>
					<td>".$fetch['lastname']."</td>
					<td>".$fetch['year']."</td>
					<td>".$fetch['section']."</td>
				</tr>
	";
	}
	
	$output .="
			</tbody>
			
		</table>
	";
	
	echo $output;
	
	
?>