whizard
06-25-2007, 04:47 PM
Hey everyone
I've been working on this for a couple of days, no success.
I have a database with the following tables:
Challenges:
id|name|year
Teams:
id|chal_id|team_num|some other non-relevant fields to this problem
Competitions:
id|chal_id|team_id|name|some other non-relevant fields to this problem
Awards:
id|comp_id|team_id|name
What I want do with this data is create an HTML table with a structure like this:
|year|1st team number from this year|first competiton for this team |first award won by this team at this competition |
| | |____________________________|second award won by this team at this competition|
| | |second competition for this team|first award won by this team at this competition |
|
There can be any number of teams, competitions, and awards for each year. Awards are the last column in the table, which means that each <td> needs to be given a rowspan equal to the number of awards it is related to.
So, if in a certain year, there were 2 teams that both had two tournaments and each of them won two awards at each tournament, the year td would need a rowspan of 8, each team td would need a rowspan of 4, and each competition td would need a rowspan of 2.
I've been messing around with loops and queries for a while, but I feel like I'm just groping in the dark.
Perhaps my database structure is no good? I can change it, if anyone has suggestions. This is the first time I've really tried to use a database extensively, so I am certainly still learning and open to any suggestions.
Thanks for reading
Dan
I've been working on this for a couple of days, no success.
I have a database with the following tables:
Challenges:
id|name|year
Teams:
id|chal_id|team_num|some other non-relevant fields to this problem
Competitions:
id|chal_id|team_id|name|some other non-relevant fields to this problem
Awards:
id|comp_id|team_id|name
What I want do with this data is create an HTML table with a structure like this:
|year|1st team number from this year|first competiton for this team |first award won by this team at this competition |
| | |____________________________|second award won by this team at this competition|
| | |second competition for this team|first award won by this team at this competition |
|
There can be any number of teams, competitions, and awards for each year. Awards are the last column in the table, which means that each <td> needs to be given a rowspan equal to the number of awards it is related to.
So, if in a certain year, there were 2 teams that both had two tournaments and each of them won two awards at each tournament, the year td would need a rowspan of 8, each team td would need a rowspan of 4, and each competition td would need a rowspan of 2.
I've been messing around with loops and queries for a while, but I feel like I'm just groping in the dark.
Perhaps my database structure is no good? I can change it, if anyone has suggestions. This is the first time I've really tried to use a database extensively, so I am certainly still learning and open to any suggestions.
Thanks for reading
Dan