Hey guys, I know this is more of a mysql question than a php question, but here goes...
I'm trying to pull data from separate tables (all with unique id's) so that I can output it all in one page.
For example :
table 1
id
name
developer
genre
table 2
id
developer
table 3
id
genre
The first table is the root with the name of the item and then reference numbers for the developer and genre, then the 2nd and 3rd tables have their own id's along with the developer name and genre name respectively.
Here's the code I'm using (the gameid comes from a url code which is why I'm using the GET global):
$gameid = $_GET['gameid'];
$selectgame = sprintf("SELECT * FROM game g, developer d, genre r WHERE g.id='%s' AND g.developer=d.id AND g.genre=r.id",mysql_real_escape_string($gameid));
$gameselect = mysql_query($selectgame, $db_connection);
while ($row = mysql_fetch_assoc($gameselect)) {
There's something wrong just in that bit because it doesn't even get as far as retrieving any values from the rows selected and brings up loads of errors on my page due to it. The error comes in at the last line saying fetch_assoc's supplied arguement is invalid.
I'm pretty new to joins of any kind in mysql queries so I've probably just missed something 😛