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
| <?
$db = mysql_connect('localhost', 'root', '');
mysql_select_db('site',$db);
$sql = 'SELECT pseudo,points FROM membre ORDER BY points DESC limit 0, 5';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
echo '<table border="1" cellpadding="3" cellspacing="0" width="50%">';
echo '<tr>';
echo '<td>Classement</td>';
echo '<td>Pseudo</td>';
echo '<td>points</td>';
echo '</tr>';
$classement = 1;
while( $data = mysql_fetch_assoc($req) ){
echo '<tr>';
echo "<td>$classement</td>";
echo "<td>$data['pseudo']</td>";
echo "<td>$data['points']</td>";
echo '</tr>';
$classement++;
}
echo '</table>';
mysql_free_result ($req);
mysql_close ();
?> |