lengman Posted November 16, 2008 Share Posted November 16, 2008 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)){ Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 16, 2008 Share Posted November 16, 2008 Change $drop_bar =mysql_query("SELECT * FROM bar"); to $drop_bar =mysql_query("SELECT * FROM bar") or die(mysql_error()); and tell us what error it gives then. Quote Link to comment Share on other sites More sharing options...
lengman Posted November 16, 2008 Author Share Posted November 16, 2008 It's not changed anything at all.... Still: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/igweeccr/public_html/includes/functions.php on line 212 Thanks for helping me too. Quote Link to comment Share on other sites More sharing options...
lengman Posted November 16, 2008 Author Share Posted November 16, 2008 I know the coding's poor too. Even though it is poor though, as far as I'm aware it should be working fine Quote Link to comment Share on other sites More sharing options...
redarrow Posted November 16, 2008 Share Posted November 16, 2008 please use this link to see the format ur using might be wrong.. http://uk.php.net/mysql_fetch_object Quote Link to comment Share on other sites More sharing options...
lengman Posted November 16, 2008 Author Share Posted November 16, 2008 As far as I'm aware of and can see, it's definitely the correct Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 16, 2008 Share Posted November 16, 2008 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); Quote Link to comment Share on other sites More sharing options...
lengman Posted November 16, 2008 Author Share Posted November 16, 2008 aaaaaa... Still giving the same error, I just honestly can't figure it out for the life of me ??? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 16, 2008 Share Posted November 16, 2008 Neither can I ??? You sure this is the line 212? Quote Link to comment Share on other sites More sharing options...
lengman Posted November 16, 2008 Author Share Posted November 16, 2008 Yeah, Line 212 = $drop_bar =mysql_query("SELECT * FROM bar") or die(mysql_error()); but the fetch object is line 213: while($tard_bar=mysql_fetch_object($drop_bar)){ I really can't figure it out. Quote Link to comment Share on other sites More sharing options...
lengman Posted November 16, 2008 Author Share Posted November 16, 2008 .. Quote Link to comment Share on other sites More sharing options...
Andy-H Posted November 16, 2008 Share Posted November 16, 2008 BTM scripts are crap, add me on msn I will give you some (slightly) better ones I coded a while back andy-holland@live.co.uk Quote Link to comment 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.