modified: server.js
This commit is contained in:
parent
763a9a1da6
commit
d27b061fe4
@ -53,7 +53,7 @@ function getSensorData(callback) {
|
|||||||
|
|
||||||
// 获取数据库中最新的数据
|
// 获取数据库中最新的数据
|
||||||
function getLatestSensorData(callback) {
|
function getLatestSensorData(callback) {
|
||||||
const sql = 'SELECT temperature, humidity, co2, pressure FROM sensor_data ORDER BY timestamp 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