beennn Posted November 17, 2012 Share Posted November 17, 2012 (edited) I've set up highscores for a game i'm working on, though im faced with an issue when two people get the same score. I want the player who achieved the score first to be at the top of the leader boards. Does anyone have any suggestions on how I can achieve this? Any help or pointers would be great, and sorry if this isn't the correct place to be asking. Edited November 17, 2012 by beennn 1 Link to comment Share on other sites More sharing options...
Ingolme Posted November 18, 2012 Share Posted November 18, 2012 I think in SQL it would be something like this: SELECT * FROM high_scores ORDER BY score DESC, date (Supposing the date of the high score was stored in the table) Link to comment Share on other sites More sharing options...
thescientist Posted November 18, 2012 Share Posted November 18, 2012 As Ingolme alluded to, you would want to save the time that user set the high score. The most flexible way to save dates is as a timestamp.http://php.net/manual/en/datetime.gettimestamp.php From this point onward, you can ORDER BY in the query against the name of the column that you saved the timestamp in, or ORDER BY the high score, and if you have a tie, the user with the "smaller" timestamp would be listed first. Link to comment Share on other sites More sharing options...
beennn Posted November 18, 2012 Author Share Posted November 18, 2012 Thank you both very much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now