我正从MySQL数据库填充数组,问题是我在我的下拉框中获得9个空白字段,我试图用它填充它。我做错了什么?PHP多维数组帮助
PHP代码:
while($row = mysql_fetch_assoc($results))
{
$options[] = array(
Name => $row['Name'],
Value => $row['Value'],
ID => $row['CID']
);
}
下拉框:
for ($i = 0; $i < 9; $i++)
{
print '<option id="'.$options[$i]["ID"].'" value="'.$options[$i]["Value"].'">'
.$options[$i]["Name"].
'</option>'."\n";
}
请'print_r($ options);'在* while循环后显示输出*。 –