Hello everyone;
I have a three tables;
item
item_id
item_name
person
person_id
person_name
item_person (LINK TABLE)
item_id
person_id
When adding to the database I use a check box form to list all the items. This then builds an array.
I can then insert that data in the link table;PHP Code:$result=mssql_query($query);
while($array = mssql_fetch_assoc($result)){
$item_id = $array['item_id'];
$item_name = $array['item_name'];
echo "$item_name<input type=\"checkbox\" name=\"items[]\" value=\"item_id\"><br />";
}
My question is how can I create an update form containing all the items in the ITEM table and have those items preselected where there is a record in the link table.PHP Code:foreach ($items as $item_id)
{
$query="INSERT into item_person (item_id, person_id) values ('$item_id','$person_id')";
$result=mysql_query($query);
}
Anyone who helps with this can take the rest of the day off.
Many thanks.
Will![]()





Bookmarks