PHP - how to sort values from a lottery table
I'm having the following problem:
- let's imagine we have the lottery records, but we need to sort the values. I have already tried the code of the documentation of the php
- asort
, but it does not work!
I'm using the 7.2.4
version of php
(I hope it doesn't have a bug)!
I want to sort the numbers that are in n1
, n2
, n3
, n4
, n5
and n6
.
Ex: the record id=2032
, should have n1=6
, n2=14
, n3=19
, n4=20
, n5=39
and n6=53
.
Code:
$result = mysqli_query($db, "SELECT * FROM table32");
while ($dados = mysqli_fetch_array($result, MYSQLI_BOTH)) {
$valores = array(
"n1" => $dados['n1'], "n2" => $dados['n2'],
"n3" => $dados['n3'], "n4" => $dados['n4'],
"n5" => $dados['n5'], "n6" => $dados['n6']
);
asort($valores);
foreach ($valores as $n => $val) {
echo "$n = $val"; //Não chega aqui!
}
}
0
Author: Wictor Chaves, 2018-04-21