I'm trying to make a ranking system, where the user name and punctuation appears. I'm doing the following:
$select = $mysqli->query("select username, pontos from data order by pontos desc limit 10");
$row = $select->num_rows;
$get = $select->fetch_array();
$top_1 = $get[0];
$top_1_pontos = $get[1];
$top_2 = $get[2];
$top_2_pontos = $get[3];
Using an echo in $top_1
it displays the name of the user with the highest score.
Using an echo in $top_1_pontos
it displays the user's score.
From $top_1_pontos
it does not display anything else ... what did I do wrong?
What is the correct way to get the ranking by searching all users and listing the top 10?
MySql looks something like this:
INSERT INTO 'data' ('id','username','pontos') VALUES
(1,'Joao',9321),
(2,'Maria',151000),
(3,'Pedro',21201),
(4,'Jose',31252),
(5,'Antonio',131145),
(6,'Adriano',13211),
(7,'Marcelo',6897),
(8,'Juliana',53144);