需要把数组插入到mysql数据库中,使用JavaScript比如说我要插入的数组是:[{"biaoduan":"1","amount":"1"},{"biaoduan":"2","amount":"2"},{"biaoduan":"3","amount":"3"},{"biaoduan":"4","amount":"4"},{"biaoduan":"5","amount":"5"}]想把biaodaun和amount分别插入到数据库中两个对应的字段中,请问应该怎么做?
1 回答
MMTTMM
TA贡献1869条经验 获得超4个赞
使用node吗
如果是node-mysql的话
const mysql = require('mysql').createConnection(options)
let sql = 'insert into tableName set ? '
mysql.query(sql, array, callback)
添加回答
举报
0/150
提交
取消