query
#9

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:
PHP код:
SELECT COUNT(id) AS count FROM `table_nameWHERE money '1000' 
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
Reply


Messages In This Thread
rank - by BaubaS - 12.03.2012, 13:02
Re: query - by BaubaS - 12.03.2012, 18:26
Re: query - by Vince - 12.03.2012, 18:41
Re: query - by MP2 - 12.03.2012, 19:19
Re: query - by BaubaS - 12.03.2012, 19:53
Re: query - by BaubaS - 13.03.2012, 10:43
Re: query - by TTJJ - 13.03.2012, 10:49
Re: query - by BaubaS - 13.03.2012, 10:55
Re: query - by TTJJ - 13.03.2012, 11:24
Re: query - by BaubaS - 13.03.2012, 12:16

Forum Jump:


Users browsing this thread: 3 Guest(s)