Created
August 19, 2012 15:07
-
-
Save kylejohnson/3395399 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find all of the sensors | |
$query_sensors = 'select distinct statisticName from statistics where statisticName != "Voltage"'; | |
$result_sensors = mysql_query($query_sensors) or die ('query failed: ' . mysql_error()); | |
while ($row = mysql_fetch_array($result_sensors)) { | |
$sensors[] = $row[0]; | |
} | |
// For each sensor, query the values, put them into an individual array | |
foreach ($sensors as $sensor) { | |
$$sensor = "select statisticName, statisticValue from statistics where statisticName = '$sensor' and date(from_unixtime(statisticDate)) = curdate() order by statisticDate"; | |
$result = $sensor; | |
$$result = mysql_query($$sensor) or die('Query failed: ' . mysql_error()); | |
while ($row = mysql_fetch_array($$result)){ | |
${datay_.$sensor}[] = $row[1]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment