我試圖顯示一天的能源產生的曲線。所以曲線必須始終在增長。增加一個變量與以前的
我嘗試增加變量「energie_journ」我以前的所有mysql數據庫。
例:
MySQL的:
ID energie_journ
1 5
2 5
3 10
4 6
期望的結果:
First energie_journ = 1, the second = 10 (5 +5), third = 20 (5 +5 +10), fourth = 26 (5 +5 +10 +6).
位PHP:
while ($row2 = mysql_fetch_array($result2)) {
extract($row2);
$datetime *= 1000;
$encode_energie_journ[] = array((float)$datetime, (float)$energie_journ == null ? null : (float)$energie_journ);
}
感謝。
您應該將_每行值添加到累加器變量。 – alexis