我想比較一個從mysql中取出的值與從mysql中取出的數組的比較。代碼如下所示:比較一個值與一個數組
$aeSelect = "SELECT id, firstName, lastName from user WHERE fiID = 0 AND access = 3 ORDER BY lastName";
$aeQuery = mysql_query($aeSelect) or die ("Could not get AE list: " . mysql_error());
while ($rowAE = mysql_fetch_array($aeQuery)) {
echo "<option " . (($row['aeid'] == $rowAE['id']) ? "selected='selected'" : "") . ">" . $rowAE['firstName'] . " " . $rowAE['lastName'] . "</option>";
}
$row['aeid']
是20022和$rowAE['id']
是不良的ID的列表。
我不能這樣做,因爲選擇菜單顯示所有AE的名稱,但沒有選擇正確的名稱。爲什麼?我究竟做錯了什麼?
如何變$行已初始化? –