[thelist] [MySQL / PHP] - Getting a specific row and then a few either side of it?

Tris beertastic at gmail.com
Wed Apr 16 06:04:38 CDT 2008

Hi all..
I've a score board thingy, that I need to show the user where in the ranking
they are.
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...

The only variable I wanna pass to that query is my unique ID No (each user
has one)

Is there an SQL query to do that, or would I have to combine two query


"The only people who don't make mistakes are those who don't do anything"

Give a man a fish and he'll feed himself for a day.
Give a man a religion and he'll starve to death praying for a fish.

`We are what we pretend to be, so we must be careful what we pretend to be.`
Kurt Vonnegut

`When a person can no longer laugh at himself, it is time for others to
laugh at him.`
Thomas Szasz

More information about the thelist mailing list