Bonjour jai crée un tableau avec les résultats de ma requete, le tableau affiche tout simplement le contenue de ma table Offre, sur les entetes des colonnes jai des liens, quand je clique sur un des liens, le tri croissant fonctionne, cependant le tri decroissant ne fonctionne pas, je suis bloqué depuis, hier soir, jai beau faire plei nde test ais je comprend plus la.
J'utilise une base sous mysql.
Pouvez vous m'aider svp
Ps: je débute
voila une partie de mon code
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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130 <?php include('testeurDeSession.php'); include('connexion.php'); if (isset($_GET['t'])) { $t=$_GET['t']; if ($t=='a') { $txt="Le client a été ajouté avec succès."; } elseif ($t=='m') { $txt="Le client a été modifié avec succès."; } elseif ($t=='s') { $txt="Le client a été supprimé avec succès."; } } $SQL = "SELECT * FROM offre "; $tri=""; $d=""; $ti=""; $a=""; //tri des colonnes if (isset($_GET['tri'])) {$tri=$_GET['tri'];} elseif (isset($_GET['d']) and !empty($_GET['d']) and !$_GET['d']=="") { echo "test2 $d"; $d=$_GET['d']; echo "test3 $d"; } elseif (isset($_GET['ti'])) {$t=$_GET['ti'];} elseif (isset($_GET['a'])) {$a=$_GET['a'];} echo "tri : $tri<br\>d : $d<br\>t : $ti<br\>"; if (($tri=="d" and $d=="") or $tri=="") { $SQL=$SQL." ORDER BY date_publication".$d; $d="DESC"; echo "1er if"; } elseif ($tri=="d" and $d=="DESC" ) { $SQL=$SQL." ORDER BY date_publication ".$d; $d=""; echo "2eme if"; } elseif ($tri=="ti" and $ti=="" ) { $SQL=$SQL." ORDER BY titre".$ti; $ti="DESC"; echo "3eme if"; } elseif ($tri=="ti" and $ti=="DESC" ) { $SQL=$SQL." ORDER BY titre ".$ti; $ti=""; } elseif ($tri=="a" and $a=="" ) { $SQL=$SQL." ORDER BY attribuee".$a; $a="DESC"; } elseif ($tri=="a" and $a=="DESC" ) { $SQL=$SQL." ORDER BY attribuee ".$a; $a=""; } $res = mysql_query($SQL); echo $SQL; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Document sans titre</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .Style2 {color: #33CC99} --> </style> </head> <body bgcolor="#99FF99"> <p align="center" style="font-weight:bold " >Gestion des clients</p> <br /> <a href="Ajout/ajout.php">Ajouter un Client</a> <br /><br /> <?php if (!empty($t)) { ?><span class="Style2"><?php echo $txt?> <br \><br \></span> <?php } ?> <table border="1"> <tr align="center"> <td><a href="clients.php?tri=d&d=<?php echo $d?>">Date</a></td> <td><a href="clients.php?tri=ti&ti=<?php echo $ti?>">Titre</a></td> <td><a href="clients.php?tri=a&a=<?php echo $a?>">Attribuée</a></td> <td>Formations</td> <td colspan="4">Edition</td> </tr> <?php while($rows=mysql_fetch_assoc($res)) { ?> <?php $datePub = $rows['date_publication']; list($aPub, $mPub, $jPub) = split("-", $datePub); ?> <tr align="center"> <td><?php echo "$jPub/$mPub/$aPub";?> </td> <td><?php echo $rows['titre'];?> </td> <td><input name="attribue<?php echo $rows['no_offre'];?>" type="radio" value="" disabled="disabled" <?php if ((bool)$rows['attribuee']) {echo "checked";} ?> > </td>
Partager