I have this sql table
username | coins| id | date
test | 1 | 5 | 05-26-2020
test | 1 | 4 | 05-26-2020
test | 1 | 2 | 05-26-2020
test | 1 | 5 | 05-26-2020
test | 1 | 7 | 05-26-2020
test | 1 | 5 | 05-26-2020
test | 1 | 1 | 05-26-2020
and I have to do SELECT username
FROM coins_logs
WHERE id =5
and save the results in an array, so I'll can do echo $results[4] and print the 4th username
but how can I do it?
update
this is my code:
$idprodotto = '5';
$query = mysqli_query($con,"SELECT username FROM coins_logs WHERE id= '$idprodotto';");
$utentiUltimi = mysqli_fetch_array($query);
echo $utentiUltimi[1];
echo $utentiUltimi[0];
echo $utentiUltimi[3];
I've tried to do print_r($utentiUltimi) and this is the result: Array( [0] => test ) so I think that don't take all the data