Join two MySQL tables into PHP
Posted: Mon Feb 06, 2012 3:10 pm
Hello there,
Currently I am learning PHP/MySQl and there is one issue that most likely is extremly simple but still I just don't get it into my head. Let's say I have two tables with this content:
Company
- company_name
- company_location
Game
- game_name
- game_rating
Now I would like to combine these two tables into a PHP form, for example:
RockstarGames an American Company publishes a new game called Red Dead Redemption 3 and it is rated with 4,5 stars
How exactly am I doing this? I watched a lot of tutorials but I just don't get it.
I think I understood that I need another field in game such as company_id
But how exactly can I make sure that PHP is giving me the right game to the company that has created the game and how can I display this information (including location) into PHP?
Many Thanks for your help,
Daniel
Currently I am learning PHP/MySQl and there is one issue that most likely is extremly simple but still I just don't get it into my head. Let's say I have two tables with this content:
Company
- company_name
- company_location
Game
- game_name
- game_rating
Now I would like to combine these two tables into a PHP form, for example:
RockstarGames an American Company publishes a new game called Red Dead Redemption 3 and it is rated with 4,5 stars
How exactly am I doing this? I watched a lot of tutorials but I just don't get it.
I think I understood that I need another field in game such as company_id
But how exactly can I make sure that PHP is giving me the right game to the company that has created the game and how can I display this information (including location) into PHP?
Many Thanks for your help,
Daniel