Jump to content

mysql fetch object problem


lengman

Recommended Posts

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/igweeccr/public_html/includes/functions.php on line 212

 

I'm very new to PHP and am in need for some help... this is the code..

 

$drop =mysql_query("SELECT * FROM casinos");

while($tard=mysql_fetch_object($drop)){
$per = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard->owner'"));
if ($per->status == "Dead" || $per->status == "Banned"){
mysql_query("UPDATE casinos SET owner='0' WHERE casino='$tard->casino' AND owner='$tard->owner'");
}

}
$drop_bar =mysql_query("SELECT * FROM bar");
while($tard_bar=mysql_fetch_object($drop_bar)){
$per_bar = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard_bar->owner'"));
if ($per_bar->status == "Dead" || $per_bar->status == "Banned"){
mysql_query("UPDATE bar SET owner='0' WHERE owner='$tard_bar->owner'");
}

 

Could the problem be with the database, basically this part of the code is a feature on my game... a bar script.... My friend uploaded all the data onto the database, but I can't find the bar on the database... Me and my friend wrote this code, so I don't need to go to the third party thread.

 

Thanks for the help in advance.

 

P.S Line 212 =

while($tard_bar=mysql_fetch_object($drop_bar)){

Link to comment
Share on other sites

I've gut this feeling...

 

Change:

$per_bar = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$tard_bar->owner'"));

 

to

 

$result = mysql_query("SELECT * FROM users WHERE username='$tard_bar->owner'") or die(mysql_error);
$per_bar = mysql_fetch_object($result);

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.