Is that a way to custom the header of a generated csv file :
$result = $db->select(" table","",""," fitstname, lastname, campany");
$headers = array("fistname","lastname","campany");
$fp = fopen('php://output', 'w');
if ($fp && $result) {
header('Content-Type: text/csv ; charset=utf-8');
header('Content-Disposition: attachment; filename="recap.csv"');
header('Pragma: no-cache');
header('Expires: 0');
fputcsv($fp, $headers);
for ($i= 0; $i < sizeof($result); $i++) {
fputcsv($fp, array_values($result[$i]));
}
die;
}
updated : here the output :
nom,prenom,societe
Charles,Olivier,"Zed way"
Bernard,Gautier,"Media Productions"
Regards .