Bonjour
J'aimerai faire apparaitre les intitulés sur ma première ligne de mon fichier .CSV .
Je cherche depuis quelques jours mais je n'arrive pas...
Si quelqu'un pouvais m'aider
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 if (isset($_POST['recupheurestock'])) { header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=recuperationheuresstock.csv"); header("Pragma: no-cache"); header("Expires: 0"); $cnx = new PDO('mysql:dbname=EMPL;host=localhost', 'root', 'XXXX'); $sth = $cnx->prepare('SELECT nom,datehs,heure,com,demande,valid,solde,stock FROM validhs WHERE stock=""'); $sth->execute(array(':nomstock'=>$_POST['nomstock'])); while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { echo implode(';', $row) . "\r\n"; } exit(); }
Partager