for(i in req.body.category_id){
db.query('INSERT INTO guide_categories(category_id) values($1)', [req.body.category_id[i]],function(err,category) {
if(err) return next(err);
return console.log("success");
});
}
category_id:["3","1"]
, but the last value of the array is got inserting and rest is not. How to solve this??
db.query
is async?.. – Vao Tsun 19 hours ago