Jump to content

Another WHERE clause problem


burtybob

Recommended Posts

This works as long as i keep it fetching the array with where userid=$c_userid

	if ($_REQUEST[killname]) {
$victim=$_REQUEST[killname];
        $killquery=mysql_query("SELECT * FROM members WHERE `userid`=$c_userid") or die(mysql_error());
$killquery=mysql_fetch_array($killquery);
$killquery=$killquery[health];
}

BUT this DOESNT work

	if ($_REQUEST[killname]) {
$victim=$_REQUEST[killname];
$killquery=mysql_query("SELECT * FROM members WHERE `displayname`=$victim") or die(mysql_error());
$killquery=mysql_fetch_array($killquery);
$killquery=$killquery[health];
}

 

Please can anyone inform me as to why the second one wont work when all i do is change the WHERE clause?

Is it something im doing rong or is there a genuine reason it tells me

faultCode0faultStringWarning:mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vol4/byethost7.com/b7_568567/lealtatest.22web.net/htdocs/Source code/kill.php on line 161

 

line 161 is the fetch array bit.

 

Thanks in advance.

Link to comment
Share on other sites

Why use the same variable in difrent ways $killquery

$killquery=mysql_fetch_array($killquery);

$killquery=$killquery[health];

 

Used as a query

used as a result

used as a value

 

This can cause confusion later.

 

I read somewhere on this forum that some other people managed to use this way also it makes sense to me as im using one variable name instead of 4 different ones :)

 

I tried with the quotes and

faultCode0faultStringWarning:mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vol4/byethost7.com/b7_568567/lealtatest.22web.net/htdocs/Source code/kill.php on line 161

is the result still but the die is not telling me any problems???

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.