Bonjour,

Je voulais faire un mode de tri pour ce tableau, soit trié par date, soit par intitulé. Savez vous comment ajouter cette fonction pour un tableau?

Merci bp

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
 
function affichedevoirs(){
$req = "SELECT intitule, enonce, date_rendu
        FROM devoirs, enseignements
        WHERE devoirs.id_ec=enseignements.id";
$res =mysql_query($req);
$nb = mysql_num_fields($res);
echo "<CENTER>\n<TABLE BORDER=\"1\" WIDTH=100%>\n<TR ALIGN=\"CENTER\">\n";
for($i=0; $i<$nb; $i++){
    $nomcol=mysql_field_name($res, $i);
    echo "<TD ALIGN=\"center\"><B>$nomcol</B></TD>";}
    echo "</TR>";
while($ligne=mysql_fetch_object($res)){
echo "<TR><TD ALIGN=\"CENTER\" WIDTH=20%>$ligne->intitule</TD><TD ALIGN=\"CENTER\" WIDTH=70%>$ligne->enonce</TD><TD ALIGN=\"CENTER\" WIDTH=10%>$ligne->date_rendu</TD></TR>"; 
}
echo "</TABLE></CENTER>\n";}