tiweb Posted April 23, 2011 Share Posted April 23, 2011 error Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/nrkgamin/public_html/perp/gameserver/fetch_users5.php on line 7 <?php mysql_connect("xxxxxxx", "xxxxxxxx", "xxxxxxx"); mysql_select_db("phpbb"); $query = mysql_query("SELECT phpbb_profile_fields_data.pf_steamid, phpbb_users.user_rank FROM user, phpbb_profile_fields_data WHERE (phpbb_users.user_rank='16' OR phpbb_users.user_rank='10' OR phpbb_users.user_rank='9' OR phpbb_users.user_rank='14' OR phpbb_users.user_rank='11' OR phpbb_users.user_rank='15' OR phpbb_users.user_rank='13' OR phpbb_users.user_rank='12' OR phpbb_users.user_rank='44' OR phpbb_users.user_rank='47') AND phpbb_users.user_id=phpbb_profile_fields_data.user_id"); while ($row = mysql_fetch_assoc($query)){ if ($row['pf_steamid'] != "" && $row['user_rank'] != ""){ echo $row['pf_steamid'] . "\t" . $row['user_rank'] . "\n"; } } ?> srr for my bad english Quote Link to comment https://forums.phpfreaks.com/topic/234530-need-help-to-fix-my-php-script/ Share on other sites More sharing options...
gevensen Posted April 23, 2011 Share Posted April 23, 2011 try this to help determine the error this is wrong: while ($row = mysql_fetch_assoc($query)){ should be: $result=mysql_query($query) or $debug_message.=mysql_error()."<br>"; while ($row = mysql_fetch_assoc($result)){ <?php mysql_connect("xxxxxxx", "xxxxxxxx", "xxxxxxx"); mysql_select_db("phpbb"); $debug_message="START DEBUG<br/>"; $query = mysql_query("SELECT phpbb_profile_fields_data.pf_steamid, phpbb_users.user_rank FROM user, phpbb_profile_fields_data WHERE (phpbb_users.user_rank='16' OR phpbb_users.user_rank='10' OR phpbb_users.user_rank='9' OR phpbb_users.user_rank='14' OR phpbb_users.user_rank='11' OR phpbb_users.user_rank='15' OR phpbb_users.user_rank='13' OR phpbb_users.user_rank='12' OR phpbb_users.user_rank='44' OR phpbb_users.user_rank='47') AND phpbb_users.user_id=phpbb_profile_fields_data.user_id"); $result=mysql_query($query) or $debug_message.=mysql_error()."<br>"; while ($row = mysql_fetch_assoc($result)){ if ($row['pf_steamid'] != "" && $row['user_rank'] != ""){ echo $row['pf_steamid'] . "\t" . $row['user_rank'] . "\n"; } } debug_message.="END DEBUG MESSAGE<br/>"; echo $debug_message; ?> Quote Link to comment https://forums.phpfreaks.com/topic/234530-need-help-to-fix-my-php-script/#findComment-1205301 Share on other sites More sharing options...
tiweb Posted April 23, 2011 Author Share Posted April 23, 2011 fixed fogot one table on the code Quote Link to comment https://forums.phpfreaks.com/topic/234530-need-help-to-fix-my-php-script/#findComment-1205308 Share on other sites More sharing options...
gevensen Posted April 23, 2011 Share Posted April 23, 2011 mark it solved Quote Link to comment https://forums.phpfreaks.com/topic/234530-need-help-to-fix-my-php-script/#findComment-1205332 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.