Jump to content

need help to fix my php script


tiweb

Recommended Posts

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

 

Link to comment
Share on other sites

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;
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.