我试图显示一天的能源产生的曲线。所以曲线必须始终在增长。增加一个变量与以前的
我尝试增加变量“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