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
|
<?php
$cnx = odbc_connect( "POLE_STAT_DEMAT" , "" , "" );
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-disposition: attachment;filename=test.xls");
$text = "<table border=1>";
$text .= "<tr><th><h3> Identifiant </th> <th><h3> Nom </th>
<th><h3> Complément </th> <th><h3> Adresse </th>
<th><h3> Ville </th> <th><h3> Téléphone </th>
<th><h3> Fax </th></tr>";
$cnx = odbc_connect( "POLE_STAT_DEMAT" , "" , "" );
$req_sql = " SELECT TOP 10 adm.*
FROM pai INNER JOIN adm ON pai.NO_EXTERNE = adm.[NUM+RO_DE_]
WHERE pai.CATEGORIE=30 AND pai.MAX_DIRRES=0
ORDER BY pai.MONTANT DESC;";
$color = "#c0ffe0";
while(odbc_fetch_row($sql)){
if($color=="#e0ffff"){$color = "#c0ffe0";}else{$color = "#e0ffff";}
$sql = @odbc_exec($cnx, $req_sql);
while(odbc_fetch_row($sql))
{
$text .= "<TR>";
$text .= "<TD><h5>".odbc_result($sql, 1)."</TD>";
$text .= "<TD><h5>".odbc_result($sql, 2)." ";
$text .= odbc_result($sql, 3)."</TD>";
$text .= "<TD><h5>".odbc_result($sql, 4)." ";
$text .= odbc_result($sql, 5)."</TD>";
$text .= "<TD><h5>".odbc_result($sql, 6)." ";
$text .= odbc_result($sql, 7)." ";
$text .= odbc_result($sql, 8)."</TD>";
$text .= "<TD><h5>".odbc_result($sql, 9)." ";
$text .= odbc_result($sql, 10)."</TD>";
$text .= "<TD><h5>".odbc_result($sql, 11)."</TD>";
$text .= "<TD><h5>".odbc_result($sql, 12)."</TD></TR>";
}
$text .="</table>";
echo $text;
?> |
Partager