几天前,我发现了 HighStock。我想使用 SQL 数据库中的数据。通过 php 我读出了信息并以 JSON 样式回显它
这是脚本
<?php
include ("dbverbindung.php");
echo "[";
$sql = "SELECT time, amperage FROM pikkertonnode_44664399";
$erg = mysql_query($sql);
while ($data= mysql_fetch_array($erg))
{
if ($data['amperage'] == "") $data['amperage'] = 0;
echo "[".$data['time'].",".$data['amperage']."]," ;
}
echo "]"; ?>
输出看起来是这样的:
[[1264978800000,68],[1264978805000,50],[1264978810000,61],[1264978815000,54]]
它是否正确?