Boas,
I do not understand very well the question, nor what you have already done, nor what type of database... But I will try to give some tips:
After connecting to the database (I suppose you already have) you need to query (Here in Mysql)...
I think what you want is:
$query="SELECT * FROM tb_user ORDER_BY referrals DESC"
Then you need to query:
$result=mysqli_query($link, $query);
And collect the result
$count=1;
while ($pessoa = mysqli_fetch_assoc($result)) {
echo $count."º ".$pessoa["nome"]." - Tem ".$pessoa["referrals"]." indicados.<br>";
$count++;
}
Well, if I don’t have any syntax error (I haven’t used this in a while), I guess this is it!
Supplement your question with information on how, for example, your database is modeled. So you can try to suggest a solution.
– Rodrigo Rigotti