Arbitus Posted December 9, 2008 Share Posted December 9, 2008 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 More sharing options...
gevans Posted December 9, 2008 Share Posted December 9, 2008 Put it in the database twice, once for each console Link to comment https://forums.phpfreaks.com/topic/136163-database-problem/#findComment-710206 Share on other sites More sharing options...
haku Posted December 9, 2008 Share Posted December 9, 2008 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 More sharing options...
gevans Posted December 9, 2008 Share Posted December 9, 2008 Actually, a join would be faster if there a hell of a lot of games spanning across a few consoles!! I'd go with haku's recomendation! Link to comment https://forums.phpfreaks.com/topic/136163-database-problem/#findComment-710212 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.