PHP My_SQL Linking Tables W/ Loop Question
Posted: Fri Jan 14, 2005 7:41 am
Hi,
I've been working with php for a while and feel as if I have a fairly good handle on how things work, though maybe not advanced/expert level. Anyways I am having trouble understanding how to get information from four tables to loop with each other. Any help would be appreciated.
Table one (character) would contain information such as
ID, FirstName, LastName, BirthYear, DeathYear.
Table two (details) contains info such as
ID, characterID, description, eventyear1, eventyear2
Table three (chargroups)
ID, characterID, detailsID
Table four (groupnames)
ID, groupname
While there are several characters, linked to each one might be several items under detail where details.characterID would be the same as character.ID also chargroups would link each character to one or more groups listed under groupnames table.
I want them all to appear in a table but I believe would then need to implement several loops together to get it to work.
Loop 1 the character loop
Loop 2 the details for the above character
Loop 3 the groups for the above character
I assume loops 2 and 3 would look the same and not have to be set within each other.
Any ideas if I have this right? and how to go about doing it?
Thanks a million!
I've been working with php for a while and feel as if I have a fairly good handle on how things work, though maybe not advanced/expert level. Anyways I am having trouble understanding how to get information from four tables to loop with each other. Any help would be appreciated.
Table one (character) would contain information such as
ID, FirstName, LastName, BirthYear, DeathYear.
Table two (details) contains info such as
ID, characterID, description, eventyear1, eventyear2
Table three (chargroups)
ID, characterID, detailsID
Table four (groupnames)
ID, groupname
While there are several characters, linked to each one might be several items under detail where details.characterID would be the same as character.ID also chargroups would link each character to one or more groups listed under groupnames table.
I want them all to appear in a table but I believe would then need to implement several loops together to get it to work.
Loop 1 the character loop
Loop 2 the details for the above character
Loop 3 the groups for the above character
I assume loops 2 and 3 would look the same and not have to be set within each other.
Any ideas if I have this right? and how to go about doing it?
Thanks a million!