[thelist] [MySQL / PHP] - Getting a specific row and then a few
r937
rudy at r937.com
Wed Apr 16 07:08:20 CDT 2008
> So if there were 100 people playing and I was position 42,
> I'd want to select from the row, ordering by score,
> positions 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 etc...
>
> Thoughts?
sure, thoughts
how do you know where a certain user ranks? by comparing his score to the
every other user's score
correct?
this can be achieved with SQL, but it's convoluted
(it's actually real easy with windowing functions, by mysql doesn't support
those)
since you are talking about 100 users, my advice is to sort them by score
and read them all into a php array, then pick out the selected user and the
5 on either side
it's a lot easier that way, yes?
rudy
http://r937.com/
More information about the thelist
mailing list