On Sun, August 20, 2006 12:30 am, Bigmark wrote: > Hi, can anyone help me with this at all. > > i have a table leaderboard with username points etc and can echo the > scores > in asc order ok but what i want is to grab the scores and display a > users > position using their session ID. > > So if the scores are for example: > 36 user3 > 22 user1 > 18 user4 > 12 user2 > > How do i show user 1's position on the leaderboard on their user login > page. > here are the fields in table 'leaderboard' > ID > user_id > username > points > comp_id > email This is an SQL question, so you'll find much better answers on an SQL forum. If all else fails, I guess you could just do the whole ranking, and then run through counting up the rows until you find the current person... Since that would be relativly expensive, perhaps you could run it as a cron job once a day or once a week and store it in a field on their profile. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php