Forum Moderators: coopster

Message Too Old, No Replies

Resource id #2 Error

Any Ideas

         

brant

5:47 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



The following queary is giving me problems

function checkID($ID) {
$link = open_npc();
$query = "SELECT status
FROM guards
WHERE ID='$ID'";
$result = mysql_query($query);
mysql_close($link);
if ($result['status'] > 0) return ture;
else return false;
} // end function checkID()

When I just return the results it gives me the following: Resource id #2 Error

mincklerstraat

6:30 pm on Jul 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you can get more info about this if you put this after your line
$result = mysql_query($query);
:

if(!$result) echo mysql_error();

when getting your script to upload to your live server, erase this line or comment it out.

brant

6:47 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



I placed it but it didn't do anything.

brant

7:08 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



It seems that the sql queary is not returning any inforamtion. I believe I am connected to the MySQL server but I am not sure.

coopster

10:25 am on Jul 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, brant.

Some things to check ...
Are you sure you are connecting to the database? Check your $link variable.
Dump the query to the browser to check the validity.
You have "true" spelled incorrectly.

function checkID($ID) { 
$link = open_npc();
$query = "SELECT status FROM guards WHERE ID='$ID'";
exit($query); // dump the query to see what's wrong ...
$result = mysql_query($query);
mysql_close($link);
if ($result['status'] > 0) {
return true;
} else {
return false;
}
} // end function checkID()