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
|
$query = "SELECT tbl_emails.code_emailing,email,nombre,timestamp
FROM tbl_emails, emailing
WHERE tbl_emails.code_emailing = emailing.code_emailing AND id=$id";
$result = mysql_query($query) or die('Erreur SQL !<br />' . $query . '<br />' . mysql_error());
//Boucle sur les resultats
while($row = mysql_fetch_array($result)) {
$email=str_replace(' ','',$row['email']);
if ($row['timestamp'] == 0)
{
//if ($_POST['site3_concert'] == '')
$row['timestamp'] = "NULL";
}
else {
$date_visite = strtotime($row['timestamp']);
$date_visite = date("Y-m-d H:i:s", $row['timestamp']);
}
$csv_output .= "$email;$row[nombre];$date_visite;$row[code_emailing]\n ";
}
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=Expedition_". date("Ymd").".csv");
header("Content-Type: text/csv; charset=utf-8");
print $csv_output;
exit;
} |
Partager