i have to update multiple rows (around 32rows at most) in a table. currently my code can delete the rows specified but cant insert. am i missing something? my code looks like this:
connection.query("DELETE FROM items WHERE record_id = ?", id, function (err, result) {
    if(err)
    { console.log("ERROR UPDATE" + err); }
    else
    { 
        console.log("entered UPDATE");
        // Loop through Hour Difference 
        for (var i = 1; i <= hours; i++) {
            // Avoiding Add in the first iteration
            if (i != 1) {
              start_date_time.add(1, "hours");
            }
          // Convert Date Format to MYSQL DateTime Format
          var myDate3 = moment(start_date_time.format('YYYY-MM-DD HH:mm:ss')).format("YYYY-MM-DD HH:mm:ss");
          console.log('Index update [' + i + ']: ' + myDate3);
          var data = {
              name: req.body.site_name,
              remarks: req.body.remarks,
              date_part: myDate3,
              record_id: id
          }
          connection.query("INSERT INTO items SET ?", [data], function (err, result) {
              if (err) {
                  console.log(err);
              } else {
                  console.log('Index [' + i + ']: INSERTED to update');
              }
          });
        }
    }
}); 
 
     
    