MasterACE14 Posted July 10, 2008 Share Posted July 10, 2008 I'm getting a error I've never encountered before and have no idea whats causing it. here's the error: Fatal error: Unsupported operand types in /home/ace/public_html/realmbattles/test.php on line 251 and here's the relevant code: <?php for ($i = 1; $i <= 8; $i++) { $sql = "SELECT `cbank` FROM `Clans` WHERE `id` = '".$i."'"; $result = mysql_query($sql) or die('you screwed up the taxes 13!'.mysql_error()); // $bank = mysql_result($result,0,"cbank"); $bank = mysql_fetch_array($result); if ($bank > 1000000000) { $arcane = floor($bank/1000000000);// line 251 $banktake = $arcane*1000000000; $sql = "UPDATE `Clans` SET `arcane` = `arcane` + '$arcane', `cbank` = `cbank` - '$banktake' WHERE `id` = '".$i."'"; mysql_query($sql) or die('you screwed up the taxes 13!'.mysql_error()); } } any help is greatly appreciated. Regards ACE Link to comment https://forums.phpfreaks.com/topic/114028-solved-fatal-error-unsupported-operand-types/ Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 Which line is the error on? Link to comment https://forums.phpfreaks.com/topic/114028-solved-fatal-error-unsupported-operand-types/#findComment-586052 Share on other sites More sharing options...
MasterACE14 Posted July 10, 2008 Author Share Posted July 10, 2008 <?php $arcane = floor($bank/1000000000);// line 251 Link to comment https://forums.phpfreaks.com/topic/114028-solved-fatal-error-unsupported-operand-types/#findComment-586053 Share on other sites More sharing options...
trq Posted July 10, 2008 Share Posted July 10, 2008 $bank is an array. You cannot test to see if an array is > 1000000000, not can you devide an array by 1000000000. Link to comment https://forums.phpfreaks.com/topic/114028-solved-fatal-error-unsupported-operand-types/#findComment-586063 Share on other sites More sharing options...
trq Posted July 10, 2008 Share Posted July 10, 2008 Change this.... $bank = mysql_fetch_array($result); to $row = mysql_fetch_array($result); $bank = $row['cbank']; Link to comment https://forums.phpfreaks.com/topic/114028-solved-fatal-error-unsupported-operand-types/#findComment-586065 Share on other sites More sharing options...
MasterACE14 Posted July 10, 2008 Author Share Posted July 10, 2008 thats done the trick. Thanks heaps Thorpe Link to comment https://forums.phpfreaks.com/topic/114028-solved-fatal-error-unsupported-operand-types/#findComment-586077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.