Jump to content

Database problem


Arbitus

Recommended Posts

Alright guys, I got another one for you.

 

So I'm working on a section of this project where you select a gaming system (xbox 360 for example) and it shows all of the games that havee 'x360' in the database under the system field.

 

$gamesql = "SELECT * FROM games WHERE system='$system' ORDER BY title ASC";

 

like this.  Well the only problem now is, games like grand theft auto 4 that are for both xbox 360 and the PlayStation 3.  With the piece of code I showed here, it is only looking for x360 for example in the field 'system'.

 

What I am trying to ask is, what would be the best way for me to only have 1 table for games and I can pull grand theft auto from that table because it is for x360 at one point, then later on it will be able to pull that same table of grand theft auto because it is for PlayStation 3 also.

Link to comment
https://forums.phpfreaks.com/topic/136163-database-problem/
Share on other sites

Or have two tables.

 

Table one:

 

game_id, game_name

 

Table two:

 

game_id, console

 

 

In this way, the game is logged into table one and given a name and an ID. That ID is then logged twice into the second table - once for each console.

 

You can then use a join function to get all the game names for a particular console.

Link to comment
https://forums.phpfreaks.com/topic/136163-database-problem/#findComment-710208
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.