Hi there, I'm pretty new to mySQL and wondered if anyone could help with a problem ive got?
I have a table that holds players scores for a game im trying to make,
what i want to do is return where a particular player is in that list ordered by high score.
I know that i could work this out with PHP - but i think that i would need to return the whole player scores table which given there could be a couple of thousand players of this thing (ever the optimist) seems rather drastic given that i just want one tiny number.
My thinking is that i first need to order the table into descending order to get the high scores at the top and low at the bottom. I then just want to return the row that the players details are on (identified by their email) so far ive not found a function to do this straight off.
From googling around ive managed to cobble the following code together:
'select @row_val:=email from scores where email = ' myEmail ' order by score desc; select count(email) as pos from scores where email < @row_val';
I don't understand it entirely but at any rate it works in the command prompt 🙂 - but wont when called from my php page 🙁
I'm not sure why, anyone have any ideas?
Thanks