0

Hello guys, right now am trying to develope many php applications trying to learn php,
now am good enough to start my own project, and am thinking to develope a games staticstis site for PS3 players
I've done a leaderboard containe many players to get thier stats from Sony
here is an example : http://pic4u.netau.net/iqlb/indexv2.php
now am trying to add games sections which contain games that players have, so if someone clicked on player name it will shows his games,
now its come to my first question in project.
if I create a 'games' table in my DB how I linke those games to specific players ?

2
Contributors
2
Replies
20
Views
4 Years
Discussion Span
Last Post by OsaMasw
2

Disclaimer: I don't have a ton of experience designing DB schemas, and in fact my SQL is rusty, so I'm actually just putting this out there because I want to know others' thoughts.

I'd probably go about this having 3 tables:
players
* id
* name
* username
* etc.

games
* id
* name
* platform
* etc.

games_played
* player_id
* game_id
* hours_played
* etc.

This way you can run queries based on what you want. If you're on a player page, you could pull all records from games WHERE games.id = games_played.game_id AND games_played.player_id = [the player whose page you're on]. Alternatively, on a game page, you can list who's played the game by selecting from players WHERE players.id = games_played.game_id AND games_played.game_id = [the game whose page you're on].

Hope that makes sense.

Edited by EvolutionFallen: Added "etc." to third table

Votes + Comments
that fine idea
0

Ok thats a good idea but it will take many records in games_played table if I have 100 players and every player played 100 games that will be 10000 row, I can do this with one table.
I already have players table

players

*id
*username

games_table

*id
*player_id
*game_name
*last_played
*etc..

I want to reduce the amount of rows so I can update them easily.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.