modified: server.js

This commit is contained in:
IrisVega 2024-07-20 17:12:35 +08:00
parent d27b061fe4
commit 0416545e38
1 changed files with 1 additions and 1 deletions

View File

@ -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);