Monday, 1 May 2017

NodeJs Mysql - passing SQL Function(NOW()) with object

so I'm trying to make a table row update with some data and date = NOW(), and it seems to be more annoying than I had thought. Here is what I tried and didn't work for some reason:

var sql_query_data = [{size:fileSize , loc:filename} , row_id];
con.query("UPDATE files SET ? AND date = NOW() WHERE id = ?" , sql_query_data , function ...)

And here's another one that didn't help (and I understand why):

var sql_query_data = [{size:fileSize , loc:filename, date:"NOW()"} , row_id];
con.query("UPDATE files SET ? WHERE id = ?" , sql_query_data , function...)

Does anyone have a good solution for me?



via sermonion x

No comments:

Post a Comment