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:
<?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
}
?>
merci d'vavance