Raised This Month: $ Target: $400
 0% 

Another question with MySQL: Get rank based XP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Marcoux
Junior Member
Join Date: Oct 2009
Old 10-10-2009 , 14:51   Another question with MySQL: Get rank based XP
Reply With Quote #1

Well, let's suppose we have a table like this:

SteamID-----------XP

With around 5000 rows.

I want to get the rank of certain SteamID, I know how to do the "top", where with just a ORDER BY I can get it. But not get the rank number of someone.

The diference is that, with just an ORDER BY I can get who are the ten players who have the highest XP, but if I want to know the rank of certain player, I cant.

Keep in mind that I think to show this in a HUD, so It shouldn't burn the CPU. I don't ask for queriyng every second, but maybe every round.

Last edited by Marcoux; 10-10-2009 at 19:16.
Marcoux is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-10-2009 , 17:45   Re: Another question with MySQL: Get rank by XP
Reply With Quote #2

SELECT XP FROM your_table WHERE SteamID="His ID here";
vitorrd is offline
10101010
BANNED
Join Date: Oct 2009
Old 10-10-2009 , 17:57   Re: Another question with MySQL: Get rank by XP
Reply With Quote #3

Quote:
Originally Posted by vitorrd View Post
SELECT XP FROM your_table WHERE SteamID="His ID here";
Retard?
10101010 is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-10-2009 , 18:02   Re: Another question with MySQL: Get rank by XP
Reply With Quote #4

Quote:
Originally Posted by 10101010 View Post
Retard?
Excuse me, kid? He asked how to check for a Steam ID's rank.
vitorrd is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-10-2009 , 18:03   Re: Another question with MySQL: Get rank by XP
Reply With Quote #5

lol, it seems he doesn't know about SQL.
__________________
Arkshine is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-10-2009 , 18:07   Re: Another question with MySQL: Get rank by XP
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
lol, it seems he doesn't know about SQL.
Who exactly are we talking about here? Haha.
vitorrd is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-10-2009 , 18:15   Re: Another question with MySQL: Get rank by XP
Reply With Quote #7

-_-"
__________________
Arkshine is offline
Marcoux
Junior Member
Join Date: Oct 2009
Old 10-10-2009 , 19:13   Re: Another question with MySQL: Get rank by XP
Reply With Quote #8

Quote:
Originally Posted by 10101010 View Post
Retard?
Indeed, he is.
Quote:
Originally Posted by vitorrd View Post
SELECT XP FROM your_table WHERE SteamID="His ID here";
Quote:
Originally Posted by vitorrd View Post
Excuse me, kid? He asked how to check for a Steam ID's rank.
Have you read the entire post? Of course I know how to select the XP from certain value. I want to know how to get the position it has certain value when you do an ORDER BY.

In simple words, retrieve the rank of something based on certain value.
Quote:
Originally Posted by Arkshine View Post
lol, it seems he doesn't know about SQL.
Who do you refer to?
Marcoux is offline
Marcoux
Junior Member
Join Date: Oct 2009
Old 10-10-2009 , 19:27   Re: Another question with MySQL: Get rank based XP
Reply With Quote #9

Sorry for doublepost, but it was needed.

I will explain a bit more what I want.

Lets suppose the table is like this

--ID---Score
65-5000
86-4000
106-10000
56-2000

As you can se, I have a normal table where I can get the score of someone in a really simple way.

Now, lets say player 65 connects, I want to tell you "You are second in the rank", whose rank would be based on the score of each player in the DB
Marcoux is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-10-2009 , 20:03   Re: Another question with MySQL: Get rank based XP
Reply With Quote #10

Quote:
I want to get the rank of certain SteamID, I know how to do the "top", where with just a ORDER BY I can get it. But not get the rank number of someone.
Excuse me if your brain is not capable of expressing what you want correctly. Suit yourself.
vitorrd is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode