13.03.2012, 11:24
Hi Again BaubaS,
I have been looking around and stumbled across a different method. However this method assumes that you already have the players money. So for instance the user is online and wants to know their money rank, you know they have 1000. You would then exectue the following query:
The row "count" would then be the number of users who have more money than the user who initiated the query, giving your user their place in the table. So for instance
Player A has 1000
Player B has 2000
Player C has 3000
If player A initiates this query then it will look for all users who have more money than him and return the number of results it finds, in this case 2. Therefore player A's position is 3.
Hope that made sense.
Cheers,
TJ
I have been looking around and stumbled across a different method. However this method assumes that you already have the players money. So for instance the user is online and wants to know their money rank, you know they have 1000. You would then exectue the following query:
PHP код:
SELECT COUNT(id) AS count FROM `table_name` WHERE money > '1000'
Player A has 1000
Player B has 2000
Player C has 3000
If player A initiates this query then it will look for all users who have more money than him and return the number of results it finds, in this case 2. Therefore player A's position is 3.
Hope that made sense.
Cheers,
TJ