Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

PHP:Classificando o resultado do MySQL para array multidimensional

$values = array(); //base array
while ($line = mysql_fetch_assoc($front_end_query_result)){ //fetch the rows
    //in the base array create a new array under 'name'
    $values[$line['name']] = array(); 
    //for each item in the result set, add it to the new array
    foreach ($line as $key => $value) {
        $values[$line['name']][$key] = $value;
    }
}