Bonsoir
Voici le code de l'affichage de mes tableaux
-le premier pour les résultats de - de 50 véhicules
-le second pour les résultats de + de 50 véhicules
j'ai donc 2 requêtes ($query et $query2)
Code php : 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 <?php // on lance la requête pour récupérer les enregistrements correspondants au numéro de page courante $query = "SELECT * FROM devis3 WHERE qte<50 ORDER BY id_devis DESC"; $resultat = mysql_query ($query) or die('pb de connexion ?'); // tant qu'il y a un enregistrement, les instructions dans la boucle s'exécutent ?> <h3>- de 50 véhicules</h3> <?php echo "<table class='full list'>"; echo "<tr>"; echo "<th align='center' width='2%'>id</th>"; echo "<th align='center' width='9%'>Date</th>"; echo "<th align='center' width='2%'>Qte</th>"; echo "<th align='center' width='10%'>Type</th>"; echo "<th align='center' width='10%'>Délai</th>"; echo "<th align='center' width='10%'>Nom</th>"; echo "<th align='center' width='10%'>Prénom</th>"; echo "<th align='center' width='10%'>Fonction</th>"; echo "<th align='center' width='10%'>Société</th>"; echo "<th align='center' width='7%'>CP</th>"; echo "<th align='center' width='10%'>Email</th>"; echo "<th align='center' width='10%'>Téléphone</th>"; echo "</tr>"; while ($ligne = mysql_fetch_assoc($resultat)) { echo "<tr>"; echo "<td align='center' width=''>".$ligne['id_devis']."</td>"; echo "<td align='center' width=''>".$ligne['date']."</td>"; echo "<td align='center' width=''>".$ligne['qte']."</td>"; echo "<td align='center' width=''>".$ligne['type']."</td>"; echo "<td align='center' width=''>".$ligne['delai']."</td>"; echo "<td align='center' width=''>".$ligne['nom']."</td>"; echo "<td align='center' width=''>".$ligne['prenom']."</td>"; echo "<td align='center' width=''>".$ligne['fonction']."</td>"; echo "<td align='center' width=''>".$ligne['societe']."</td>"; echo "<td align='center' width=''>".$ligne['cp']."</td>"; echo "<td align='center' width=''>".$ligne['mail']."</td>"; echo "<td align='center' width=''>".$ligne['tel']."</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='12'><span style='font-weight: bold'>Commentaires : </span>".$ligne['contenu']."</td>"; echo "</tr>"; } echo "</table>"; if(isset($erreur)) echo $erreur; // on lance la requête pour récupérer les enregistrements correspondants au numéro de page courante $query2 = "SELECT * FROM devis3 WHERE qte>50 ORDER BY id_devis DESC"; $resultat2 = mysql_query ($query2) or die('pb de connexion ?'); // tant qu'il y a un enregistrement, les instructions dans la boucle s'exécutent ?> <h3>+ de 50 véhicules</h3> <?php echo "<table class='full list'>"; echo "<tr>"; echo "<th align='center' width='2%'>id</th>"; echo "<th align='center' width='9%'>Date</th>"; echo "<th align='center' width='2%'>Qte</th>"; echo "<th align='center' width='10%'>Type</th>"; echo "<th align='center' width='10%'>Délai</th>"; echo "<th align='center' width='10%'>Nom</th>"; echo "<th align='center' width='10%'>Prénom</th>"; echo "<th align='center' width='10%'>Fonction</th>"; echo "<th align='center' width='10%'>Société</th>"; echo "<th align='center' width='7%'>CP</th>"; echo "<th align='center' width='10%'>Email</th>"; echo "<th align='center' width='10%'>Téléphone</th>"; echo "</tr>"; while ($ligne2 = mysql_fetch_assoc($resultat2)) { echo "<tr>"; echo "<td align='center' width=''>".$ligne2['id_devis']."</td>"; echo "<td align='center' width=''>".$ligne2['date']."</td>"; echo "<td align='center' width=''>".$ligne2['qte']."</td>"; echo "<td align='center' width=''>".$ligne2['type']."</td>"; echo "<td align='center' width=''>".$ligne2['delai']."</td>"; echo "<td align='center' width=''>".$ligne2['nom']."</td>"; echo "<td align='center' width=''>".$ligne2['prenom']."</td>"; echo "<td align='center' width=''>".$ligne2['fonction']."</td>"; echo "<td align='center' width=''>".$ligne2['societe']."</td>"; echo "<td align='center' width=''>".$ligne2['cp']."</td>"; echo "<td align='center' width=''>".$ligne2['mail']."</td>"; echo "<td align='center' width=''>".$ligne2['tel']."</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='12'><span style='font-weight: bold'>Commentaires : </span>".$ligne2['contenu']."</td>"; echo "</tr>"; } echo "</table>"; if(isset($erreur)) echo $erreur; ?>
Habituellement j'inclus un bouton checkbox qui affiche une nouvelle page suivant le mois sélectionner avec 2 nouvelles requêtes!
Pour éviter d'avoir 12 pages différentes, j'aimerais savoir comment lancer les requêtes directement lors de la sélection du mois en restant sur la même page . Donc avoir un bouton checkbox qui exécute des requêtes![]()
Merci d'avance pour le coup de main.
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 <script> function diri3(){ var choix=document.formulaire3.mois.selectedIndex switch (choix) { default:location.href="http://www.monsite/tableaux-file-devis_01.html";break; case 0:location.href="http://www.monsite/tableaux-file-devis_01.html";break; case 1:location.href="http://www.monsite/tableaux-file-devis_02.html";break; case 2:location.href="http://www.monsite/tableaux-file-devis_03.html";break; case 3:location.href="http://www.monsite/tableaux-file-devis_04.html";break; case 4:location.href="http://www.monsite/tableaux-file-devis_05.html";break; case 5:location.href="http://www.monsite/tableaux-file-devis_06.html";break; case 6:location.href="http://www.monsite/tableaux-file-devis_07.html";break; case 7:location.href="http://www.monsite/tableaux-file-devis_08.html";break; case 8:location.href="http://www.monsite/tableaux-file-devis_09.html";break; case 9:location.href="http://www.monsite/tableaux-file-devis_10.html";break; case 10:location.href="http://www.monsite/tableaux-file-devis_11.html";break; case 11:location.href="http://www.monsite/tableaux-file-devis_12.html";break; } } </script> <table width="100%"> <tr> <td> <form name="formulaire3"> Mois de: <select name="mois" onchange="diri3()"> <option selected="selected">janvier</option> <option>fevrier</option> <option>mars</option> <option>avril</option> <option>mai</option> <option>juin</option> <option>juillet</option> <option>aout</option> <option>septembre</option> <option>octobre</option> <option>novembre</option> <option>decembre</option> </select> </form></td> </tr> </table> <br />
Partager