while($tag = mysqli_fetch_assoc($result))
{
$arrayresult[$tag['id']][$tag['name']] = $tag['count'];
}
the $result contains 4 rows from database table.
i want it to be like:
$arrayresult[1]['mac'] = 34
$arrayresult[22]['pc'] = 32
$arrayresult[31]['windows'] = 14
$arrayresult[4]['linux'] = 23
the code above doesnt seems to work because it just return ONE element. seems that it saves over the preceding one.
how should i do it?
EDIT: the print_r says
Array ( [4] => Array ( [linux] => 23 ) )
We need to know the query before we can really help you but you probably need something like
or
it depends on your query
Question was updated…
Test the query in phpmyadmin or something similar. The code could be working fine, maybe you just have the data you suspect.
Also let us see your query.