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)){ Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/ 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. Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691517 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. Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691518 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 Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691520 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 Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691522 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 Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691528 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); Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691529 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 ??? Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691532 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? Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691535 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. Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691537 Share on other sites More sharing options...
lengman Posted November 16, 2008 Author Share Posted November 16, 2008 .. Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691558 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 [email protected] Link to comment https://forums.phpfreaks.com/topic/132976-mysql-fetch-object-problem/#findComment-691564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.