Sim Posted November 8, 2009 Share Posted November 8, 2009 don't know what i'm doing wrong here. game_id = 2 all my fields are right in the query anybody see a problem? $game_id = mysql_real_escape_string($_GET['id']); //retreive game data $result = mysql_query("SELECT game_data.name, game_data.platform_id, game_consoles.console FROM game_data, game_consoles WHERE game_consoles.id='game_data.platform_id' AND game_data.id='$game_id'") or die(mysql_error()); $game_data = mysql_fetch_assoc($result); var_dump($game_data); Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted November 8, 2009 Share Posted November 8, 2009 Try the query within phpMyAdmin and see it works there, that's the easiest way to debug a query. Quote Link to comment Share on other sites More sharing options...
Sim Posted November 8, 2009 Author Share Posted November 8, 2009 returns 0 results but shouldn't Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted November 8, 2009 Share Posted November 8, 2009 you have [mysql]game_consoles.id='game_data.platform_id'[/mysql] This means that game_consoles.id will check for a string which is game_data.platform_id. I doubt this is what you want, so try to remove the quotes around game_data.platform_id and it should work. Quote Link to comment Share on other sites More sharing options...
Sim Posted November 9, 2009 Author Share Posted November 9, 2009 works like a charm. thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.