2 class MyDB extends SQLite3
6 $this->open('../db/data.db');
9 function getSensorValue($id)
11 //needs error checking, but you get the idea
12 $ret = $this->query("select value from sensors where sensor_id={$id}");
13 $row = $ret->fetchArray(SQLITE3_NUM);
20 echo $db->lastErrorMsg();
25 $ret = $db->query('SELECT * from test');
26 while ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
27 echo "NUM = ". $row['num'] . "<br>\n";
30 echo "Sensor 1 value: " . $db->getSensorValue(1). "<br>\n";