1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
<?php
// Headers
$date = date("d-m-Y");
$nom_fichier = "export_".$date.".xls";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=".$nom_fichier."");
/* Includes */
include("../includes/config.php");
include("../includes/connexion.inc.php");
include("../includes/header.php");
$vSqlSelect = "SELECT *
FROM annuaires
WHERE id_site = ".$_POST['id_site'].";";
if ($tResult = $vMysqli->query($vSqlSelect))
{
$vCpt = $tResult->num_rows;
if ($vCpt> 0)
{
//On dessine le tableau
echo '<table>';
echo '<tr>';
echo '<td>';
echo 'Annuaire';
echo '</td>';
echo '<td>';
echo 'Statut';
echo '</td>';
echo '</tr>';
while ($data = $tResult->fetch_array())
{
echo "<tr>";
echo '<td>';
echo $data['adresse'];
echo '</td>';
echo '<td>';
echo $data['statut'];
echo '</td>';
echo '</tr>';
}
echo '</table>';
}else{
echo "<H3>Aucun annuaire</H3>";
}
} |
Partager