Was wondering if somebody could help me with how to construct a multidimensional array output, have been stuck on this for quite some time now. Im using PHP and MySQL database I have 3 tables 'Trophies' 'Winners' and 'LinkTable' (Full structure is below) I need to display all the trophy data (name description image) and the a table below showing all the previous winners of the trophy;
This is the desired output…
Trophy1Name [Trophy1Image]
Trophy1Description
Year FirstName SecondName
I need this to loop for all the other trophies in the DB (9 total) hence why I need the array, problem im having is, I can show all the trophies with their image and description in a loop but I cant work out how to add all the previous winners to the table.
The closest iv come is to loop each winner but this also repeats the trophy details over and over again not exactly ideal when I have over 300 different winners.
This is my mysql table structure and join:
Trophies Winners LinkTable
-------- --------- ---------
TrophyID WinnerID LT_WinnerID
TrophyName FirstName LT_TrophyID
Description SecondName
Image Year
Join:
$trophylist = mysql_query("
SELECT TrophyID, TrophyName, Description, Image, WinnerID, FirstName, SecondName, Year
FROM LinkTable
INNER JOIN Winners ON (LinkTable.LT_WinnerID = Winners.WinnerID)
INNER JOIN Trophies ON (LinkTable.LT_TrophyID = Trophies.TrophyID)");