Mysql
 sql >> Datenbank >  >> RDS >> Mysql

PHP:Sortieren des MySQL-Ergebnisses in ein mehrdimensionales Array

$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;
    }
}