有没有办法将值赋给关联数组而不用数组创建另一个维? $ 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