Hello again, this is a re-formatted version of a previous question that never got answered.
I'm trying to figure out how to create my join so that only records with a matching date_id are returned. Here's what I have so far:
$sql6 = "SELECT * FROM team_members LEFT JOIN team_members_x using (team_id)";
The team_members_x table has a date_id field that relates to a third table called 'dates'.
Later on, when I attempt to put the values from $sql6 (now called $result6) into a <select> form box using the following code, I run into problems which I'll describe below:
while ($row = mysql_fetch_array($result6)) {
$team_id = $row['team_id'];
$date_id = $row['date_id'];
$team_fname = $row['team_fname'];
$team_lname = $row['team_lname'];
if ($team_id != NULL) {
$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>";
}
}
I'm not getting what I want. What i want is one value from each entry in the team_members to show up with only those members that were previously chosen for this record to be highlighted in the list. However, what I'm getting instead is multiple entries for each team member with each team member multiply selected.
Am I doing something wrong with my join syntax? Or is the problem with my while loop?
Thanks,
S./