versuchen Sie dies while($row = mysql_fetch_array($result)) { $arr[$row['group']][] = array('val' => $row['value']); }