VegasKiller Posted July 22, 2010 Posted July 22, 2010 I am getting a this error about 50 times. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on line 180 172 $q=mysql_query("SELECT * FROM `users` WHERE `location` = '$r[cityid]'"); 173 $pricepay=mysql_fetch_array($q)*$r['citytaxprice']; 174 mysql_query("UPDATE users SET money=money+$pricepay WHERE userid=$r[cityowner]"); 175 } 176 $newcq=mysql_query("SELECT * FROM`cities`"); 177 while($newr=mysql_fetch_array($newcq)) 178 { 179 $daf=mysql_query("SELECT * FROM `users` WHERE `location` = '$newr[cityid]"); 180 if(mysql_num_rows($daf) > $newr['citymost']) 181 { 182 $rowstoupdate=mysql_num_rows($daf); 183 mysql_query("UPDATE cities SET citymost=$rowstoupdate WHERE cityid=$r[cityid]"); 184 mysql_query($query,$c) or die("\nError Executing Query 1 for updating users $i to $next\n$query\n".mysql_error()."\nError Code:".mysql_errno()); 185 } Quote
Zero-Affect Posted July 22, 2010 Posted July 22, 2010 $daf = mysql_query("SELECT * FROM `users` WHERE `location` = '{$newr[cityid]}'"); Quote
Uridium Posted July 22, 2010 Posted July 22, 2010 try using $db->query instead of mysql_query see if that helps ive seen this before on a test site i had and when i moved to a new host i had to change most things to $db->query Quote
VegasKiller Posted July 22, 2010 Author Posted July 22, 2010 $daf = mysql_query("SELECT * FROM `users` WHERE `location` = '{$newr[cityid]}'"); Ok i replaced the line with yours and now I am getting this error. User has been notified! Error Executing Query 1 for updating users to Query was empty Error Code:1065 Quote
Zero-Affect Posted July 22, 2010 Posted July 22, 2010 $q = $db->query('SELECT COUNT(userid) FROM `users` WHERE `location` = '.$r[cityid]); $pricepay = ($db->fetch_array($q) * $r['citytaxprice']); $db->query('UPDATE `users` SET `money` = `money` + $pricepay WHERE `userid` = '.$r[cityowner]); } $newcq = $db->query('SELECT * FROM`cities`'); while( $newr = $db->fetch_array($newcq) ) { $daf = $db->query('SELECT * FROM `users` WHERE `location` = '.$newr[cityid]); $rowstoupdate = $db->num_rows($daf); if ( $rowstoupdate > $newr['citymost'] ) { $db->query('UPDATE `cities` SET `citymost` = '.$rowstoupdate.' WHERE `cityid` = '.$r[cityid]); // mysql_query($query,$c) or die("\nError Executing Query 1 for updating users $i to $next\n$query\n".mysql_error()."\nError Code:".mysql_errno()); } You are running mc v2 right? Quote
VegasKiller Posted July 22, 2010 Author Posted July 22, 2010 New error lol, I dont know what version it is. My friend tuned the crap out of the engine. User has been notified! Fatal error: Call to a member function query() on a non-object on line 176 your line: $newcq = $db->query('SELECT * FROM`cities`'); Quote
rulerofzu Posted July 22, 2010 Posted July 22, 2010 Look in your class file see what $db-> you have Quote
Haunted Dawg Posted July 22, 2010 Posted July 22, 2010 Try this: $fetch = mysql_query('SELECT COUNT(`userid`) AS `count` FROM `users` WHERE `location` = '.$r['cityid']) or die(mysql_error().' on line '.__LINE__); $pricepay = (mysql_result($fetch, 'count') * $r['citytaxprice']); mysql_query('UPDATE `users` SET `money` = (`money` + '.$pricepay.') WHERE `userid` = '.$r['cityowner']); } $cities = mysql_query('SELECT `cityid`,`citymost` FROM `cities`') or die(mysql_error().' on line '.__LINE__); while($fsoc = mysql_fetch_assoc($cities)) { $rpos = mysql_query('SELECT COUNT(`userid`) AS `count` FROM `users` WHERE `location` = '.$fsoc['cityid']) or die(mysql_error().' on line '.__LINE__); $rows = mysql_num_rows($rpos); if($rows >= $fsoc['citymost']) { mysql_query('UPDATE `cities` SET `citymost` = '.$rows.' WHERE `cityid` = '.$fsoc['cityid']) or die(mysql_error().' on line '.__LINE__); if(!empty($query)) { mysql_query($query) or die(mysql_error().' on line '.__LINE__); } } } Quote
VegasKiller Posted July 22, 2010 Author Posted July 22, 2010 Try this: $fetch = mysql_query('SELECT COUNT(`userid`) AS `count` FROM `users` WHERE `location` = '.$r['cityid']) or die(mysql_error().' on line '.__LINE__); $pricepay = (mysql_result($fetch, 'count') * $r['citytaxprice']); mysql_query('UPDATE `users` SET `money` = (`money` + '.$pricepay.') WHERE `userid` = '.$r['cityowner']); } $cities = mysql_query('SELECT `cityid`,`citymost` FROM `cities`') or die(mysql_error().' on line '.__LINE__); while($fsoc = mysql_fetch_assoc($cities)) { $rpos = mysql_query('SELECT COUNT(`userid`) AS `count` FROM `users` WHERE `location` = '.$fsoc['cityid']) or die(mysql_error().' on line '.__LINE__); $rows = mysql_num_rows($rpos); if($rows >= $fsoc['citymost']) { mysql_query('UPDATE `cities` SET `citymost` = '.$rows.' WHERE `cityid` = '.$fsoc['cityid']) or die(mysql_error().' on line '.__LINE__); if(!empty($query)) { mysql_query($query) or die(mysql_error().' on line '.__LINE__); } } } Thank you. I believe it works now. There is no error. when i run the page i get this. User has been notified. I appreciate all the help I have been getting from you guys. Admin pls delete this thread now. Quote
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.