两种写法结果不同:
第一种:var sql = "INSERT INTO table1 SET ?"var messageArr = [{messsage1:"as a message"},{messsage2:"as a message"}];var value = [{message:JSON.stringify(messageArr)}];conn.query(sql, value, function(result){.......})第二种:var sql = "INSERT INTO table1 SET message = ? "var messageArr = [{messsage1:"as a message"},{messsage2:"as a message"}];var value = [JSON.stringify(messageArr)];conn.query(sql, value, function(result){.......})其中第二种成功,第一种报错: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 u
...
继续阅读
(11)