I have the following code that populates a select box from a mysql db:
while ($row = mysql_fetch_array($projteam)) {
$ids[] = $row['team_id'];
}
while ($row = mysql_fetch_array($result6)) {
$team_id = $row['team_id'];
$team_fname = $row['team_fname'];
$team_lname = $row['team_lname'];
if (in_array($team_id, $ids)) {
$option_block6 .= "<option value=\"$team_id\" selected=\"selected\">$team_fname $team_lname</option>";
} else {
$option_block6 .= "<option value=\"$team_id\">$team_fname $team_lname</option>";
}
}
This works whenever the $ids[] gets filled in the first while loop, but if their are no values in the $projteam query then i get a bunch of errors stating that $ids doesn't exist in the second while loop. What's up with my syntax?
Thanks,
S./