[thelist] Fetching rows 5 above and 5 below a target row...

Tris beertastic at gmail.com
Mon Dec 18 04:16:57 CST 2006


Hi all...

I've been asked to put together a league table thingy for a client.
What they want is to show the current users position, relative to the
whole board.

So, If I'm ranked 356 for example, on my leauge table view, I wanna
see me highlighted inthe middle and Ranks 350 - 355 above me, and then
357 - 361 below me.

each user in the DB has a score tally, that increments as the user
plays the game. (It's a quiz thing).

So eg:

SELECT userName, score FROM resultsTable WHERE userName =
'$myUserName' (and 5 above/below too!) ORDER BY score DESC LIMIT 11

Is this easy, google is making my Monday morning hard... :-(

Tris...



More information about the thelist mailing list