Error was reported when the data is stored in the Mysql

Hi everyone,
I have been trying to store the humidity and light values to a Mysql database, and displayed as a table 'mqtt', the flow is like this:


The sensed value is shown in msg.payload.payload_fields which are humidity and light, and the code of function node 'Create query in topic' is

var newmsg=new Date().toString();
msg.topic="INSERT INTO mqtt VALUES ('"+ new Date().toString() +"','"+ msg.payload.payload_fields.humidity +"','"+ msg.payload.payload_fields.light +"')";
return msg;

But there import an error:
2
I am confused of which part is wrong, maybe the code of function node. Thanks for your help!!!

What does the table in mysql look like - i.e how many rows are there?

If you have more than 3 columns defined in the table that might be the problem, you would need to specify the name of each column like this

msg.topic =   "INSERT INTO ws_sensor_data(location, sensor, value, epoch)" + 
        "VALUES('"+location+"', 'wifi_strength', "+wifi_strength+","+epoch+")";

using your own column names and variables of course.