Jump to content

High Scores List - Display username only once??


widget

Recommended Posts

Site uses php and MySQL

 

I have a game where the users score is submitted into a table that is used for lots of games.

 

The best explaination is to see for yourself.

 

Here is the output

 

Top Scores 

1. pistoche - 2727

2. pistoche - 2580

3. pistoche - 2566

4. pistoche - 2478

5. pistoche - 2431

6. pistoche - 2429

7. pistoche - 2399

8. pistoche - 2399

9. pistoche - 2397

10. pistoche - 2344

11. pistoche - 2310

12. pistoche - 2295

13. pistoche - 2176

14. pistoche - 2175

15. pistoche - 2168

16. pistoche - 2144

17. pistoche - 2121

18. pistoche - 2120

19. Lolly Pop Chicka - 2070

20. pistoche - 2062

21. j e f f g o r d o n - 2045

22. pistoche - 2041

23. pistoche - 2040

24. pistoche - 2031

25. pistoche - 2029

26. j e f f g o r d o n - 2023

27. Lolly Pop Chicka - 2019

 

and here is the code

 

$game_name = bubblepop; 
mysql_query("INSERT INTO highscores (game, user, game_name, score, daily) VALUES ('1', '$userid', '$game_name', '$score', '$datestamp')");

$x = 1;
$findTop5 = mysql_query("SELECT * FROM highscores WHERE game_name = 'bubblepop' ORDER BY score DESC LIMIT 50");
while ($getTop5 = mysql_fetch_array($findTop5))
{
$getUsername = fetch("SELECT username,display_name,premium,display_prem FROM members2 WHERE game = '1' AND id = '$getTop5[user]'");
if (($getUsername[premium] == 1) AND ($getUsername[display_prem]))
{
	$getUsername[display_name] = $getUsername[display_prem];
}
$top5 .= "$x. <A href=user_profile.php?game=$game&user=$getUsername[username]>$getUsername[display_name]</a> - $getTop5[score]<br>";
$x++;
}


$yourTotalScore = fetch("SELECT score FROM highscores WHERE game_name = 'bubblepop' AND game= '$game' AND user = '$userid'");

print "<p align=center><TABLE CELLSPACING=0 CELLPADDING=10 WIDTH=80%>
   <TR BGCOLOR=\"#F5E462\">
   
      <TD>
         <CENTER>
           <B>Top Scores</B>
         </CENTER>
     </TD>
   </TR>
   <TR BGCOLOR=\"#FCFFDE\">
      
      <TD valign=\"top\">
         $top5

         
     </TD>
   </TR>
</TABLE>

 

Is there a way to make it sort through the data to find a double up of a username and only display that usernames high score.

 

So the output would be

 

Top Scores 

1. pistoche - 2727

2. Lolly Pop Chicka - 2070

3. j e f f g o r d o n - 2045

etc etc

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.