I am getting an Undefined index: for every ID which is over a thousand. I have tried everything to get the error to disappear and am hoping someone would be able to help. Please and Thanks in advance.
$bamid is what is called from the page and it works. The error comes from this statement "$selected[$id]" which there are no errors if removed. Adding double or single quotes does not work.
<?
$sql="SELECT * users ORDER BY name ASC";
$result=mysql_query($sql);
$options = "";
while ($row=mysql_fetch_array($result))
{
$id = $row['id'];
$name = $row['name'];
$selected = array($bamid => "selected");
$options.="<option value = \"$id\" $selected[$id]>".$name.'</option>';
}
?>
<select name = "bamid">
<option>-------</option>
<? echo $options?>
</SELECT>
Sample Output from the Error Log:
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 572 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 833 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 698 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 666 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 546 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 688 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 834 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 312 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 650 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 1109 in xxxxxxxxxxxxxxx on line 173
[Sun Jun 30 01:46:55 2013] [warn] [client xx.xx.xx.xx] mod_fcgid: stderr: PHP Notice: Undefined index: 430 in xxxxxxxxxxxxxxx on line 173