我从MySQL数据库(gpio温度传感器)获取数据并将1行存储到变量中以与pCharts一起使用。这是在php
如果我手动创建变量
$sensor1c = "24.5,24.5,24.5,24.5,24.5,24.5,24.5,24.5,24.5,24.5,24.5,24.5,";
但是,如果我从数据库中获取数据,然后通过while循环将其添加到变量,则它不起作用。
$order = "SELECT sensor2c FROM (SELECT * FROM temperature ORDER BY id DESC LIMIT 12) sub ORDER BY id ASC;";
$result = mysql_query($order);
while($data = mysql_fetch_row($result))
{
$sensor1c .= $data[0];
$sensor1c .= ",";
}
有谁知道为什么两者不同? 也试了没运气
$sensor1c = (string)$sensor1c;