Redistributing query results to a two-dimensional array

1

I have the following query in DB, which returns me three information: name, location, total

list ($usuarios,$linha,$total) = buscarTopController(); 
do{ 
   echo $linha['nome'];
   echo $linha['local'];
   echo $linha['total'];
}while($linha = mysql_fetch_assoc($usuarios));

I wanted each of these values to be stored in a position of the same array.

Example:

In position: $array[0][0] , the value of $linha['nome']; is stored, in position $array[0][1] the value of local and in $array[0][2] the value of total .

    
asked by anonymous 06.01.2016 / 10:49

1 answer

1

See if it helps you

list ($usuarios,$linha,$total) = buscarTopController(); 
do{ 
    $array[] = array($linha['nome'],$linha['local'], $linha['total']);
}while($linha = mysql_fetch_assoc($usuarios));
    
06.01.2016 / 11:08