0
votes

After I upgraded my xampp to 7.1, my existing code started giving me this error

'A non-numeric value encountered ......'.

This error started after upgrade from php 7.0 to php 7.1. This is the line which the error was detected.

$totalRevenue += $orderResult['paid'];

This is the full section.

$totalRevenue = "";
while ($orderResult = $orderQuery->fetch_assoc()) {
  $totalRevenue += $orderResult['paid'];
}

The $orderResult['paid'] variable is an integer, e.g 3500. This was working well before the upgrade and all calculations were correct.

1

1 Answers

3
votes

The current value is a string. You are trying to add a number to it.

$totalRevenue = 0;