Raised This Month: $12 Target: $400
 3% 

Another question with MySQL: Get rank based XP


Post New Thread Reply   
 
Thread Tools Display Modes
10101010
BANNED
Join Date: Oct 2009
Old 10-10-2009 , 20:26   Re: Another question with MySQL: Get rank based XP
Reply With Quote #11

Quote:
Originally Posted by vitorrd View Post
Excuse me if your brain is not capable of expressing what you want correctly. Suit yourself.
Are you talking seriusly? Where do you read the word XP? I said rank, which is what I want.

I don't want to start a flame war but please read the post twice next time
10101010 is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-11-2009 , 06:14   Re: Another question with MySQL: Get rank based XP
Reply With Quote #12

Quote:
Originally Posted by 10101010 View Post
Are you talking seriusly? Where do you read the word XP? I said rank, which is what I want.

I don't want to start a flame war but please read the post twice next time
If you knew anything about programming you'd know the position of something in a "list" is called index, not rank. But, as you said, not here to start a flame war.
vitorrd is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-12-2009 , 10:27   Re: Another question with MySQL: Get rank based XP
Reply With Quote #13

SELECT * FROM `table` ORDER BY `xp` DESC
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-12-2009 , 10:42   Re: Another question with MySQL: Get rank based XP
Reply With Quote #14

Now call the moderator a retard, I dare you.

@Exolent: His point s to get the index of a row to see how good/bad a player is doing.
vitorrd is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-12-2009 , 10:48   Re: Another question with MySQL: Get rank based XP
Reply With Quote #15

Once you have the results of that query, getting the rank isn't that difficult.
Pseudo Code Example:
Code:
SQL Query: SELECT `name`, `steamid`, `xp` FROM `table` ORDER BY `xp` DESC

rank = 0
name = ""
xp = 0

row = 1
results = SQL RESULTS

while row <= results
    READ RESULT 1 steamid
    if equal steamid "specific player steamid"
        READ RESULT 0 name
        READ RESULT 2 xp
        
        rank = row
        break loop
    
    row++

if rank > 0
    print name, steamid, xp
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 16:01.


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