I'm now attempting to set up a database following this tutorial:
https://www.scirra.com/tutorials/346/on ... -php-mysql
It seems to be a pretty good alternative, and I have almost everything set up by now. However, I was wondering if anyone knew a way of getting a rank back as well (position in the list)? Say, in one layout I want to display a list showing the 10 best scores, but in another layout I want to display to the user what position in the list they are at.
The table I'm testing with now was created like this:
CREATE TABLE `scores` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 20 ) NOT NULL ,
`score` INT NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = InnoDB;
To retrieve the data I do this (lower is better in my game):
$sql="SELECT * FROM scores ORDER BY score ASC LIMIT 10";
$result=mysql_query($sql);
But how can I get and display the position in the list? I'm thinking I would need to have another column in the table, but that's as far as I've come by now.