bonjour,
je travaille sur php/mysql
j'ai une "page1.php" qui affiche tous les adherents enregistrés dans la table "Adherents".
puis dans la meme page je recupére la requete dans une variable session :
puis j'ai une autre page "export.php" qui recupére $_SESSION['queryExport'] et qui a pour but d'exporter les adherents vers un fichier excel.
Code : Sélectionner tout - Visualiser dans une fenêtre à part $_SESSION['queryExport'] = "select * from adherents"
le code de la page "export.php" est le suivant :
alors l'export des enrgistementq se fait bien dans un file Excel...sauf que le premier enregistrement (adherent) de la table "Adherents" n'est pas exporté dans Excel.
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
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 <?php session_start(); include ('connect.php'); $query = $_SESSION['queryExport']; $result = mysql_query($query, $connexion) or die(mysql_error()); ini_set('max_execution_time', 0); header("content-type: application/octet-stream"); header("Content-Type: application/vnd.ms-excel"); //include("../configuration.inc.php"); if ($_SESSION['NumRep'] == 1) { $row_affichageDate = mysql_fetch_array($result); $file_name = "liste des adherents"; $extension = ".xls"; $fichier = $file_name.$extension; header("Content-Disposition: attachment; filename=".$fichier); echo "<table cellpadding=\"4\"> <tr bgcolor=\"#cccccc\"> <td><strong>num inscription</strong></td> <td><strong>nom </strong></td> <td><strong>adress</strong></td> <td><strong>num portable</strong></td> </tr>"; $couleur = 0; while($row_affichage = mysql_fetch_array($result)) { if($couleur%2 == 0) { echo "<tr bgcolor=\"#ffffff\">"; } else { echo "<tr bgcolor=\"#D7F1B4\">"; } ?> <td><?php echo ($row_affichage['num_inscp_ben']); ?></td> <td><?php echo ($row_affichage['nom_adh']); ?></td> <td><?php echo ($row_affichage['adresse_adh']); ?></td> <td><?php echo ($row_affichage['tel_portabl_adh']); ?></td> </tr> <?php $couleur++; } echo "</table>"; } ?>
je ne vois pas à quoi ca peut etre du?
merci par avance
Partager