Update postgreql database with Node.js
问题 I try to Update a table on postgresql so for that i'm creating two arrays var name_ = []; var id_ = []; then i creat a forEach loop where MyRow is the query that contain different data MyRow.rows.forEach(function(row){ name_.push(row.name); id_.push(row.id); }); var updateAccount = 'UPDATE myTable SET myRow =$1 '+ 'where id = $2' client.query(updateAccount,[name_.toString(),id_.toString()],false).then(function(err,result){ if (err) { console.log(err.stack); } else { console.log(name_) } });