I am building a leaderboard which is built by joining two different databases, the most important is the wallet column which is what I’ll use to rank the players. I need to add a column ranked from the player with most money to least amount of money. What is the best way to do this?
$result = mysqli_query($conn, "SELECT * FROM darkrp_player inner join playerinformation on (darkrp_player.uid = playerinformation.uid)");
2
Answers
alright these work! here's my code for anyone that might across something similar
Basically, you need to order by on your
wallet
column to short for showing most money to least amount of money of the user i.eDESC
ordering. But if you want to get the rank number value of each user also apart from ordering you can do it this way withROW_NUMBER()
window functionExpected Output: on
$result
variable