DEVILofDARKNESS Posted August 12, 2009 Share Posted August 12, 2009 I get the error Unsupported operand types?! How can I solve this? (the error said it was on the last line from the foll. code) $query = "SELECT ammount FROM " . $CoRTable . " WHERE (weapon_id = '$weaponid') AND (" . $CoRIdName . " = '$CoRId')"; $result = mysql_query($query); if(mysql_num_rows($result) == 1){ $curramm = mysql_fetch_row($result); $ammount = $_POST['ammount'] + $curramm; Link to comment https://forums.phpfreaks.com/topic/169961-solved-unsuported-operand-types/ Share on other sites More sharing options...
p2grace Posted August 12, 2009 Share Posted August 12, 2009 Try specifying the data type. $ammount = ((double) $_POST['ammount']) + $curramm; Link to comment https://forums.phpfreaks.com/topic/169961-solved-unsuported-operand-types/#findComment-896611 Share on other sites More sharing options...
Lyleyboy Posted August 12, 2009 Share Posted August 12, 2009 Is it the mySql error? Try adding or die to the end and see what that brings. If you post the actual error message and the code. Link to comment https://forums.phpfreaks.com/topic/169961-solved-unsuported-operand-types/#findComment-896614 Share on other sites More sharing options...
J.Daniels Posted August 12, 2009 Share Posted August 12, 2009 $curramm is an array. $ammount = $_POST['ammount'] + $curramm; should be: $ammount = $_POST['ammount'] + $curramm[0]; Link to comment https://forums.phpfreaks.com/topic/169961-solved-unsuported-operand-types/#findComment-896618 Share on other sites More sharing options...
DEVILofDARKNESS Posted August 12, 2009 Author Share Posted August 12, 2009 Thanks I only tried the last solution by J.Daniels, and it worked probably the other solutions worked as well but I will stick with this one untill it fails too Link to comment https://forums.phpfreaks.com/topic/169961-solved-unsuported-operand-types/#findComment-896636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.