par
demipoulp » 16 mars 2005, 18:10
si si c'ets clair ....
il faut faire un ORDER BY $variable
est tu renseigne variable en fonction de l'option choisi ...
if(isset($_GET['selection'])) { $selection=$_GET['selection'];}
switch ($selection2 {
case nom:
$order =" ORDER BY nom DESC ";
break;
case prenom :
$order =" ORDER BY prenom ASC ";
break;
default :
$order =" ORDER BY idASC ";
break;
}
ta requete :
$q=mysql_query("SELECT .... FROM .... WHERE $order ");
et tes liens de selection :
<a href="tapage.php?selection=nom" target="_self">Trie par nom</a>
etc ....
enfin quelque chose comme ca

si si c'ets clair ....
il faut faire un ORDER BY $variable
est tu renseigne variable en fonction de l'option choisi ...
[php]if(isset($_GET['selection'])) { $selection=$_GET['selection'];}
switch ($selection2 {
case nom:
$order =" ORDER BY nom DESC ";
break;
case prenom :
$order =" ORDER BY prenom ASC ";
break;
default :
$order =" ORDER BY idASC ";
break;
}[/php]
ta requete :
[php]$q=mysql_query("SELECT .... FROM .... WHERE $order ");[/php]
et tes liens de selection :
<a href="tapage.php?selection=nom" target="_self">Trie par nom</a>
etc ....
enfin quelque chose comme ca :wink: