Jump to content

Recommended Posts

I need some help with my high score table.

 

Currently it outputs the top 50 scores but not sorted by highest per user.

 

EXAMPLE OF OUTPUT

 

Top Scores 

1. Lolly Pop Chicka - 1485

2. Lolly Pop Chicka - 1102

3. Lolly Pop Chicka - 1024

4. Pistoche - 741

5. Pistoche - 727

 

CURRENT CODE

$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++;
}

 

I need to to output like this

 

Top Scores 

1. Lolly Pop Chicka - 1485

2. Pistoche - 741

 

I've had a go at grouping but couldnt get it to work.

 

If someone could please show me a code example, that would be great!!

 

Thank you in advance for any help - its much appreciated.

 

Link to comment
https://forums.phpfreaks.com/topic/58401-sorting-array-need-help-please/
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.