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
| $SQL="SELECT T_EXPOSANT.RAISON, T_EXPOSANT.NOM, T_EXPOSANT.COD_TYPE, "
."T_EXPOSANT.ADRESSE, T_EXPOSANT.CP, T_EXPOSANT.VILLE FROM T_EXPOSANT ";
$csv_output ="Raison Sociale,Nom,Adresse,CP,Ville";
$csv_output .="\r\n";
$tblREQUETE = mysql_query($SQL);
while ($val = mysql_fetch_array($tblREQUETE)) {
$Raison=ereg_replace("\r\n","\n",$val["RAISON"]);
$Raison=ereg_replace("\"","",$Raison);
$Nom=ereg_replace("\r\n","\n",$val["NOM"]);
$Nom=ereg_replace("\"","",$Nom);
$Adresse=ereg_replace("\r\n","\n",$val["ADRESSE"]);
$Adresse=ereg_replace("\"","",$Adresse);
$CP=$val["CP"];
$Ville=ereg_replace("\r\n","\n",$val["VILLE"]);
$Ville=ereg_replace("\"","",$Ville);
$csv_output .="\"$Raison\",\"$Nom\",\"$Adresse\",\"$CP\",\"$Ville\",";
$csv_output .="\r\n";
}
//#################################################################################
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=".$NomFichier.".csv");
print $csv_output;
exit;
} |
Partager