-2
我有一個週期,而返回數組數組?如何從而PHP
我有一個週期,而返回數組數組?如何從而PHP
你應該在你的while之外聲明你的數組,這樣你可以在循環之外訪問它。
試試這個:
$isUsed[];
while ($userEquipments = mysql_fetch_array($getUserEquipments))
{
if ($userEquipments['cloth_id'] == $clothes['id'] && $userEquipments['cloth_is_used'] == 1)
{
$isUsed['cloth_type'] = $clothes['type_cloth'];
$isUsed['cloth_name'] = $clothes['name'];
...
break;
}
}
// Print the array
print_r($isUsed);
'$ isUsed [] = ...'? – DaveRandom
我會用你的SQL語句來選擇某些行,而不是使用php來查看你想要的結果。在你的sql中使用where語句。 – Zombaya