1
我創建了一個腳本,通過SQL數據庫中的while循環在現有數組中設置數組。在外部使用時設置數組,同時使用
while ($nextday = odbc_fetch_array($nextdayinfo)){
$username = $nextday['user_sign'];
if(isset($username)){
$nextday[] = array('value' => $username, 'text' => $username);
}
}
這是代碼。如果我在IF條款後嘗試print_r($nextday)
,它會向我顯示所有信息,只要我在while子句後面加上print_r($nextday)
,它就會停止工作。
什麼是'$ nextday'?陣列?或從'_fetch'返回的結果? –
$ nextday是一個空數組。我想在這段時間創造它。 – Wvs
但您的數組與數據庫行具有相同的名稱,因此每次迭代都會覆蓋它。 – Jerodev