There will be hundreds of rows.
Each one will have a date entered as well.
But we need to see an "overall" top 20 list. So it needs to add up all the points of each userid, then display then in order (highest first), and only show the top 20.
Now I'm sure it's ORDER BY point LIMIT 0,20.
But I don't really know how to gather it all up, and then show it.
This is the code whereby I search by date... so you can see it needs a JOIN.
Code: Select all
$result = mysql_query ("SELECT m.id, m.username, m.firstname, m.lastname, l.time, l.hits, l.points, l.teamname, l.gun, l.dateevent FROM members AS m INNER JOIN leaderboard AS l ON l.userid = m.id WHERE l.dateevent = '$dateevent' ORDER BY l.points DESC", $dbmembers);