Bonjour, suite à un probléme avec ma demarche pour trier un tableau jai refait toutes mes fonctions, cependant il y a toujours un probleme.
Le tableau est affiché grace à une requete et la base est sous mysql
Le tri se fait grace a l'entete des colonnes du tableau, mon prob est le suivant,je clique une fois sur l'entéte, un message derreur saffiche dans la barre d'adrese:
http://127.0.0.1/Projet_php/clients.php?tri=d&ord=<br%20/><b>Notice</b>:%20%20Undefined%20index:%20%20tri%20in%20<b>c:\program%20files\easyphp1-8\www\projet_php\clients.php</b>%20on%20line%20<b>82</b><br%20/>asc
je reclique sur l'entete, plus aucun message, le tri fonctionne
Je pense à un problème d'initialisation, ou un truc comme ca, je vous donne la partie necessaire 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 <?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."; } } if (isset($_GET['tri']) and !empty($_GET['tri']) and !$_GET['tri']=="") { switch($_GET['tri']) { case "ti" : $tri = " ORDER BY titre"; break; case "d" : $tri = " ORDER BY date_publication"; break; case "a" : $tri = " ORDER BY attribuee"; break; default : $tri = " ORDER BY no_offre"; } } else { $tri = " ORDER BY no_offre"; } if (isset($_GET['ord'])) { switch($_GET['ord']) { case "asc" : $ord = " ASC"; $ord2 = "desc"; break; case "desc" : $ord = " DESC"; $ord2 = "asc"; break; default : $ord = " ASC"; $ord2 = "desc"; } } else { $ord = " ASC"; $ord2 = "desc"; } $SQL = "SELECT * FROM offre WHERE supprimee=0".$tri.$ord; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Gestion des offres de stages</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&ord=<?php if($_GET['tri'] == "d"){echo $ord2;} else { echo "asc";}?>">Date</a></td> <td><a href="clients.php?tri=ti&ord=<?php if($_GET['tri'] == "ti"){echo $ord2;} else { echo "asc";}?>">Titre</a></td> <td><a href="clients.php?tri=a&ord=<?php if($_GET['tri'] == "a"){echo $ord2;} else { echo "asc";}?>">Attribuée</a></td> <td>Formations</td> <td colspan="4">Edition</td> </tr> <?php $res = mysql_query($SQL); while($rows=mysql_fetch_assoc($res))
Merci beaucoup
Partager