Redistribute query results in a two-dimensional array

Asked

Viewed 28 times

1

I have the following query in the comic, which returns me three information: name, place, total

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

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'];, in position $array[0][1] the value of local and in $array[0][2] the value of total.

1 answer

1


See if that helps you

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.