I am relatively new to php but i am learning slowly. I am building a sports database website / cms, which is getting there very nicely.
I am having an issue joining 3 tables together, if i use then as separate queries they do 'exactly' what i want them to do, however I am at a loss as to how to join them together.
As far as i am aware i do not need to change anything in the database itself i just need to get the query correct.
Here is what i have done that works.
$get_players = mysql_query("
SELECT P.PlayerID AS id,
P.PlayerLastName AS lastname,
P.PlayerFirstName AS firstname,
P.PlayerPositionID AS position,
P.PlayerNumber AS number,
P.PlayerNationalityID AS nationality,
FROM idihc_seasons S
LEFT OUTER JOIN idihc_players P ON P.PlayerID = S.SeasonPlayerID
LEFT OUTER JOIN idihc_seasonnames SN ON SN.SeasonID = S.SeasonID
WHERE SN.SeasonPublish = 1 and P.PlayerPublish = 1
GROUP BY id
ORDER BY number
I am now trying to join data which is held in a second column on a new table, which is linked via the id between them. I can currently get the query to display the 'id' which is the unique filed but it wont change it to the new value.
What i am trying to add: -
I have the 'idihc_players' table which has in it 'PlayerPositionID' (Which is already being used in the above query)
I also have 'idihc_playersposition' which has 'PlayerPositionID' and 'PlayerPositionName'
what i wish to display is the 'PlayerPositionName' from the 'id' it finds, however i just get a blank and no data populated.