Temperature logger

"; try { /*** connect to SQLite database ***/ $dbh = new PDO("sqlite:/var/www/temperatures.sqlite"); /*** The SQL SELECT statement ***/ $sql = "SELECT * FROM samples WHERE date LIKE '$_GET[date]%'"; echo "
Date availableDetailsChart
query($sql) as $row) { echo "$row[date]
"; } $dbh = null; } catch(PDOException $e) { echo $e->getMessage(); } ?>
"; echo ""; echo ""; echo ""; foreach ($dbh->query($sql) as $row) { echo ""; echo ""; echo ""; } echo "
DateTimeTemp
" . $row['date'] . "" . $row['time'] . "" . $row['value'] . "
"; $dbh = null; } catch(PDOException $e) { echo $e->getMessage(); } // Generates the tmp/data.xml file that will be read by the FusionChart component try { $handle = fopen("/tmp/data.xml", "w"); /*** connect to SQLite database ***/ $dbh = new PDO("sqlite:/var/www/temperatures.sqlite"); /*** The SQL SELECT statement ***/ $sql = "SELECT * FROM samples WHERE date LIKE '$_GET[date]%'"; fprintf($handle,"\n"); foreach ($dbh->query($sql) as $row) { fprintf($handle,"\n"); // echo "" . $row['date'] . "" . $row['time'] . "" . $row['value'] . ""; } fprintf($handle,"\n"); $dbh = null; fclose($handle); } catch(PDOException $e) { echo $e->getMessage(); } echo ""; echo ""; // FusionChart component ?> "; } } ?>