Hi, i don't know how to do the following or even if it's possible.
These are 3 tables from my database sport:
[team]-|-----<-[team_match]->-----|-[match]
- Team:
- id (int)
- name (text)
- Team_match:
- match_id (bigint)
- team_id (int)
- score (text) {this is not an integer because it can contain "f" for "forfait"}
- home (tinyint) {this is a boolean, which indicates if the team plays at home for this match}
- Match
- id (bigint)
- time (datetime)
With this setup, a match contains two entries of Team_match.
What i want to do in PHP is creating a two-dimensional array of matches, ordered alphabetically by the team's name.
To give you an example:
3 teams: Allstars, Bulls, Children
[Allstars vs. Bulls] [Allstars vs. Children]
[Bulls vs. Allstars] [Bulls vs. Children]
[Children vs. Allstars] [Children vs.Bulls]
How can i order the data first alphabetically by the team playing home, and then by the visitors?
Thanks in advance,
greets, Kenny.