I'm trying to gather associative info from two tables that are held in a third table. Here is my table layout...
table:contact ----- rows: contact_id, firstname
table:groups ------rows: group_id, group_name
table:groupmember ------ rows: contact_id, group_id
The "groupmember" table contains associative id's relative to group membership.
Here is the code I have so far.
Any idea what I'm doing wrong?
table:contact ----- rows: contact_id, firstname
table:groups ------rows: group_id, group_name
table:groupmember ------ rows: contact_id, group_id
The "groupmember" table contains associative id's relative to group membership.
Here is the code I have so far.
Code:
<td><b>Groups: </b><form name="Group Select" method="Post" action="prcs.viewgroups.php"><select name="viewgroup">
<option value="select" selected>Group Membership</option>';
$result = mysql_query("SELECT group_id FROM groupmember INNER JOIN groups ON groupmember.group_id groups.group_id WHERE groupmember.contact_id = '$contactid'");
while($row = mysql_fetch_array($result))
{
echo "<option value=$row[group_id]";
echo ">$row[group_name]</a></option>";
}
echo '</select>
<input type="submit" name="Submit" value="Submit" />
</td>
Comment