I have an array 'flag' and I have changed the values of that array in my function. Now I need to update the same into the database, but I am unable to do so. I already have flag column in the table. I don't know how to update the value within the variable flag in the table
If I try
connection.query('UPDATE visentry SET flag = "flag" ', function(err,rows,fields) { }
It updates the column flag with value flag. If I try the following
var sql = 'UPDATE visentry SET flag= ?';
connection.query(sql,[{flag:flag}], function(err,rows,fields) {
It gives an error
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Any suggestions please