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. Quote Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/ Share on other sites More sharing options...
Solution CroNiX Posted January 9, 2015 Solution Share Posted January 9, 2015 (edited) $x = 5; $x += 5; //short for $x = $x + 5 echo $x; //10 http://php.net/manual/en/language.operators.assignment.php Edited January 9, 2015 by CroNiX Quote 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 (edited) 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. Edited January 9, 2015 by Butterbean Quote 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. Quote 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 Quote 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 (edited) 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? Edited January 9, 2015 by Butterbean Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/293767-have-never-seen-operand/#findComment-1502240 Share on other sites More sharing options...
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.