Bonjour,
je voudrais faire un classement par point mais ce qui me bloque c'est donner le même rang à deux personnes qui ont le même point.
voici mon code:
merci d'vavance
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 <?php mysql_connect("localhost", "root", ""); mysql_select_db("forumu"); function classement(){ //if(isset($_GET['id'])) $id = urldecode($_GET['id']); $results = array(); $sql = "SELECT nomcl,pointcl FROM classement ORDER BY pointcl desc"; $query = mysql_query($sql) or die("error"); while($row = mysql_fetch_assoc($query)){ $results[] = $row; } return $results; } ?> <?php $rang=0; $classements = classement(); foreach($classements as $classement){ $rang++; ?> <table width="914" border="1" > <tr style="font-family:Georgia, 'Times New Roman', Times, serif; font-size:14px; background-color:#CDCDCD; color:#000"> <td width="73" align="center"></td> <td width="48" align="center"><?php echo $classement["nomcl"]; ?></td> <td width="114" align="center"><?php echo $classement["pointcl"]; ?></td> <td width="46" align="center"><?php echo $rang; ?> </td> </tr> </table> <?php } ?>
Partager