The thing is this:
For all the subscribed players there is a random formula based on their skills. This formula has to be updated several times in a row with a sleep between it. The Calculation has to be a sum of the previous calculations + the new ones.
The thing is that I want to update the Calculation in my table wedstrijdresultaten, but because the calculation is in a while loop I cannot use
$Calculation = $row['Calculation'] + ($Skills / 35)*rand($Skills, 100);
This is what I thought would work, but it doesn’t:
$sqlUpdate = "UPDATE wedstrijdresultaten SET Calculation='".$row['Calculation'] + ($Skills / 35)*rand($Skills, 100)."'";
See “Operator Precedence” in the PHP documentation.
+and.have equal precedence, and are left-associative, so this:means this:
You need to use parentheses to force the addition to be performed before the concatenation: