有沒有辦法將值賦給關聯數組而不用數組創建另一個維? $ champion ['Champion']] ['New'] = $ row ['New']; $ {$ row ['Champion']] ['New'] = $ row ['New'];將值賦給多維關聯數組
陣列這樣
'新' 我怎麼能訪問這個價值?
$champion=array();
$champions_table= $conn->prepare("SELECT Champion, New, Passive, Q, Q2, W, W2, E, E2, R, R2 FROM champions Where Patch_No = ? ORDER BY ID ASC");
$champions_table->bind_param('s', $Patch_No);
$champions_table->execute();
$champions_table_result = $champions_table->get_result();
while($row = $champions_table_result->fetch_assoc()){
//Getting General Changes
$champion[$row['Champion']]['New'] = $row['New'];
}
道歉,如果我的誤解,但你可以用$ existi爲數組賦值ngarray ['new'] = $ whateveryouwant' – mattslone
@mattslone如何檢索所述值?我已經嘗試過像echo $ champions [$ row ['Champion']] ['New'];沒有成功 – Higeath
不,我只是想知道如果'新'價值是0或1爲specyfic冠軍回聲$冠軍['東西'] ['新'],我想從這個1或0 – Higeath