--- /dev/null
+SQLite approach to interfacing with web frontend:
+
+*Main program reads in sensor data and updates the sqlite database
+ with this new data
+*When sqlite.php is called, the database is queried, and the values returned
+ to the caller (format can be anything you like)
+*You could have a main webpage, ie index.html
+*Whenever you need to update the page, you use jQuery (or other method)
+ to call sqlite.php, which returns the data needed
+
+This works because SQLite allows concurrent access to the database
+(or it should).
\ No newline at end of file
--- /dev/null
+<?php
+ class MyDB extends SQLite3
+ {
+ function __construct()
+ {
+ $this->open('../db/data.db');
+ }
+
+ function getSensorValue($id)
+ {
+ //needs error checking, but you get the idea
+ $ret = $this->query("select value from sensors where sensor_id={$id}");
+ $row = $ret->fetchArray(SQLITE3_NUM);
+ return $row[0];
+ }
+ }
+
+ $db = new MyDB();
+ if (!$db) {
+ echo $db->lastErrorMsg();
+ } else {
+ echo "yay<br>\n";
+ }
+
+ $ret = $db->query('SELECT * from test');
+ while ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
+ echo "NUM = ". $row['num'] . "<br>\n";
+ }
+
+ echo "Sensor 1 value: " . $db->getSensorValue(1). "<br>\n";
+ $db->close();
+
+?>
\ No newline at end of file