将值分配给关联数组(多维)

时间:2015-08-31 21:03:13

标签: php arrays multidimensional-array

facelets.jar

为了更好地展示我的问题,这里是一个带有来自$ test - array http://i.imgur.com/xcox2df.png的var_dump的图像,并且在Q W E旁边它应该显示变量$ column;我试图在这一行中实现这一目标

while($row = $champions_table_result->fetch_assoc()){

   while($row3['Champion']==$row['Champion']){
     $test[$row['Champion']]['General']['Change'][] =$row3['Stat_Change'];
     $test[$row['Champion']]['General']['Type'][] = $row3['Stat_Change_Icon'];
   }

   foreach ($row as $column_name => $column) {
     if ($column_name == 'Champion') {
       continue; // These fields were already displayed above
     }

     if (!empty($column)) {
       $test[$row['Champion']][$column_name] =$column; 
       while($row2['Champion']==$row['Champion']&&$row2['Spell_Type'] 
       ==$column_name&&!empty($row2['Spell_Change'])) {
          $test[$row['Champion']][$column_name]['Change'][] = $spell_descriptions[          $champion_counter][$spell_counter][$change_counter];
          $test[$row['Champion']][$column_name]['Type'][] = $spell_changes[ 
          $champion_counter][$spell_counter][$change_counter];
          $row2 = $spells_table_result->fetch_assoc();
        }

     }

  }

}

如果没有这一行,我会得到我在imgur上展示的内容,但是这行我得到一个错误:  警告:非法字符串偏移'更改'和致命错误:不能将字符串偏移用作数组

0 个答案:

没有答案