Bonjour,
Voila, j'ai un tout petit problème de rien du tout.
j'ai beau chercher sur les forums, et je ne trouve pas de réponse à mon problème.
j'ai un petit tableau (http://84.101.228.160/consultation.php) tout simple qui se créer tout seul par un php.
le tableau va gentiment chercher les valeurs stockées dans en base de données et me les affiche par ordre d'entrée.
jusque la tout va.
maintenant j'aimerai cliquer sur mon entête de colonne pour afficher les données par ordre croissant. en plus claire, j'ai 3 colonnes, nom premon et cp.
j'aimerai cliquer sur "nom" pour tier les données par ordre croissant selon les noms
la même chose avec "prenom" et "cp".
mon code php actuel est :
comment faire
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 <?php virtual('/Connections/root.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_root, $root); $query_Recordset1 = "SELECT * FROM nom"; $Recordset1 = mysql_query($query_Recordset1, $root) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>repertoire</title> </head> <body> <table width="52%" height="46" border="1"> <tr> <td width="32%" nowrap="nowrap" height="21" class="TitleColor">nom</td> <td width="12%" nowrap="nowrap" class="TitleColor">prenom</td> <td width="56%" nowrap="nowrap" class="TitleColor">cp</td> </tr> <?php do { ?> <tr> <td nowrap="nowrap" class="ListTitleColor"><?php echo $row_Recordset1['nom']; ?></td> <td nowrap="nowrap" class="ListTitleColor"><?php echo $row_Recordset1['prenom']; ?></td> <td nowrap="nowrap" class="ListTitleColor"><?php echo $row_Recordset1['cp']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> </body> </html> <?php mysql_free_result($Recordset1); ?>
merci de répondre en langage de non-geek
y4 p4s qu3 d3s G33K sur t3rr3
Partager