I'm having trouble storing the values of ORDER BY
in php, I'd like to store them in an array and show it on another page.
Database file with function:
function buscar_rank($conexao) {
$sqlBusca = 'SELECT * FROM usuario ORBER BY pontos;';
$resultado = mysqli_query($conexao, $sqlBusca);
$usuarios = array();
while ($rank = mysqli_fetch_assoc($resultado)) {
$usuarios[] = $rank;
}
return $usuarios;
}
file where you would like to store results
<table>
<tr>
<?php $lista_rank = buscar_rank($conexao);
foreach($lista_rank as $rank) :
?>
<td><?php echo $rank['nome']; ?></td>
<td><?php echo $rank['pontos']; ?></td>
</tr>
<?php endforeach; ?>