I am using MySql with node.js
I have this query and it not works, temp1 in MySQL is alwayls NULL:
var queryTemp1 = { tid: '1', temp: temp1, timestamp: myDate };
con.query('INSERT INTO temps SET ?', queryTemp1, function(err,res){
if(err) throw err;
console.log('Last insert ID:', res.insertId);
});
temp1 is float I think- - i can print it and everything is OK:
var temp1 = parseFloat(stdout);
var temp1 = temp1/1000
var temp1 = (temp1.toFixed(2));
My table has columns:
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| tid | smallint(6) | YES | | NULL | |
| timestamp | datetime | YES | | NULL | |
| temp | float(4,2) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
What am I doing wrong?