modified: server.js
This commit is contained in:
parent
d27b061fe4
commit
0416545e38
@ -53,7 +53,7 @@ function getSensorData(callback) {
|
|||||||
|
|
||||||
// 获取数据库中最新的数据
|
// 获取数据库中最新的数据
|
||||||
function getLatestSensorData(callback) {
|
function getLatestSensorData(callback) {
|
||||||
const sql = 'SELECT temperature, humidity, co2, pressure timestamp FROM sensor_data ORDER BY id DESC LIMIT 1';
|
const sql = 'SELECT temperature, humidity, co2, pressure,timestamp FROM sensor_data ORDER BY id DESC LIMIT 1';
|
||||||
db.query(sql, (err, results) => {
|
db.query(sql, (err, results) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Error fetching latest sensor data: ', err);
|
console.error('Error fetching latest sensor data: ', err);
|
||||||
|
Loading…
Reference in New Issue
Block a user