Butterbean Posted January 9, 2015 Share Posted January 9, 2015 I have looked everywhere trying to find out what += means. I am getting an error , Fatal error: Unsupported operand types in C:\xampp1\htdocs\Utrack\invoice.php on line 73". I just realized after upgrading from mssql 2008r2 to mssql 2014, this error started. Can someone please help me a bit? Thanks. Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/ Share on other sites More sharing options...
CroNiX Posted January 9, 2015 Share Posted January 9, 2015 $x = 5; $x += 5; //short for $x = $x + 5 echo $x; //10 http://php.net/manual/en/language.operators.assignment.php Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/#findComment-1502217 Share on other sites More sharing options...
Butterbean Posted January 9, 2015 Author Share Posted January 9, 2015 if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ $sumUsageKWH += $row['totalUsage'];}sqlsrv_free_stmt($query);?> This is how its being used. I will read your link. Thank you. Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/#findComment-1502218 Share on other sites More sharing options...
Butterbean Posted January 9, 2015 Author Share Posted January 9, 2015 Got it! Thank you. Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/#findComment-1502220 Share on other sites More sharing options...
CroNiX Posted January 9, 2015 Share Posted January 9, 2015 No, it's saying $sumUsageKWH = $sumUsageKWH + $row['totalUsage'] so it's just adding $row['totalUsage'] to $sumUsageKWH Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/#findComment-1502221 Share on other sites More sharing options...
Butterbean Posted January 9, 2015 Author Share Posted January 9, 2015 I see that now. Thank you for your help. I wonder why its returning an error in php 5 whereas it did not in earlier versions. Does Php55 accept this operand? Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/#findComment-1502222 Share on other sites More sharing options...
Barand Posted January 9, 2015 Share Posted January 9, 2015 What do var_dump($sumUsageKWH) and var_dump($row['totalUsage']) show on that line Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/#findComment-1502240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.