|
Hi Guys,
Wondering if anyone can help
I have two tables a 'game' and 'appearances' table saved in mysql database.
Now I want to create a php template to call the data out of these two tables and display the data saved onto my template. Each of these tables hold several record id's
Now I need to somehow link both tables together so that my template sees the 'game' table for the match, and also the 'appearance' table and pulls that out that correct apperance data for that match also. So I think I need to create some sort of unique identifier for each table that pulls the data together?
Here are the two tables:
From the 'game' table
- $matchdate
- $hometeam
- $score
- $awayteam
- $homeone
- $hometwo
- $homethree
- $awayone
- $awaytwo
- $awaythree
- $attendance
- $venue
- $byline
- $competition
- $opening
- $body
From the 'appearances' table
- $shirtone
- $r1
- $shirttwo
- $r2
- $shirtthree
- $r3
- $shirtfour
- $r4
- $shirtfive
- $r5
- $shirtsix
- $r6
- $shirtseven
- $r7
- $shirteight
- $r8
- $shirtnine
- $r9
- $shirtten
- $r10
- $shirteleven
- $r11
- $shirttwelve
- $r12
- $shirtfourteen
- $r14
- $shirtfifteen
- $r15
- $shirtsixteen
- $r16
- $shirtseventeen
- $r17
Now in English those two tables the 'game' table holds all the scores, date of the match, who wrote the report, match report text etc.
The apperances table holds all of the details for each match who played in what game so $shirtone would be the goalkeeper and - $r1 would be who replaced him as sub.
So on my template I may want it to pull out the following data and this is how it would look live:
---------------------
TEMPLATE:
Beaconsfield 3-1 An Other
Goalkeeper: Alan Rush
Replacement: John Walsh
---------------------
So the php for this template would be:
---------------------
TEMPLATE:
<?php echo $hometeam; ?><?php echo $score; ?><?php echo $awayteam; ?>
Goalkeeper:<?php echo $shirtone; ?>
Replacement:<?php echo $r1; ?>
---------------------
But the data is taken from both the tables in the template above, so I want to link them together for each football match played.
Anyone advise?
Ta
Chris
|