ffsja
08-12-2005, 02:42 AM
Hello, I'm creating a data entry/update/delete system using PHP/MySQL and I'm having trouble with creating and using relationships.
Some background: I've got a 'main' table called 'dates' that has several 'foreign keys' referencing several other tables. 'Dates' also references some tables through the 'Dates' primary key (date_id). These tables are sort of composite tables acting as intermediaries between 'Dates' and another set of tables because otherwise it would be a many:to:many relationship. The intermediary tables only contain the primary keys of each of the other tables. So for example, 'Team Members' has a team_id field for each team member. An intermediary table called 'Team_Members_x' has a team_id field AND a date_id field. Therefore, each date can include several team members.
I'm having a difficult time figuring out how to add and/or update data to these intermediary tables. For example, when I create a new 'date' (which is easy to do) the user is able to select 1 or more team members. I would then like the intermediary table 'team_members_x' to have added to it records corresponding to the date_id and the team_id for each team_member added to the date.
I'm wondering, what is the syntax used to accomplish this kind of thing in php/mysql?
S./
Some background: I've got a 'main' table called 'dates' that has several 'foreign keys' referencing several other tables. 'Dates' also references some tables through the 'Dates' primary key (date_id). These tables are sort of composite tables acting as intermediaries between 'Dates' and another set of tables because otherwise it would be a many:to:many relationship. The intermediary tables only contain the primary keys of each of the other tables. So for example, 'Team Members' has a team_id field for each team member. An intermediary table called 'Team_Members_x' has a team_id field AND a date_id field. Therefore, each date can include several team members.
I'm having a difficult time figuring out how to add and/or update data to these intermediary tables. For example, when I create a new 'date' (which is easy to do) the user is able to select 1 or more team members. I would then like the intermediary table 'team_members_x' to have added to it records corresponding to the date_id and the team_id for each team_member added to the date.
I'm wondering, what is the syntax used to accomplish this kind of thing in php/mysql?
S./