With the code below I can display all users, because I put DESC
and variable $num
and it increments the placement with $num++;
.
But what if I want to get the / rank from the guy who is logged in ($_SESSION)
and not all?
<?php
include "../banco_de_dados/banco_cadastro.php";
$sql= mysql_query("SELECT * FROM rank ORDER BY pontuacao DESC");
echo "<table>";
echo"<th > Colocação </th> <th> Nome </th> <th > Pontuação </th> ";
$num=1;
while ($row = mysql_fetch_array($sql))
{
echo "<tr>";
echo"<td >" . $num . "º</td>";
echo "<td > " .$row['nome'] . "</td>";
echo "<td > " .$row['pontuacao']. "</td>";
echo"</tr>";
$num++;
}
echo "</table>"; ?> </div>