Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

nodejs mysql getting the number of affected rows

connection.query('UPDATE posts SET ...', function (error, results, fields) {
  if (error) throw error;
  console.log('changed ' + results.changedRows + ' rows');
})

connection.query('DELETE FROM posts WHERE title = "wrong"', function (error, results, fields) {
  if (error) throw error;
  console.log('deleted ' + results.affectedRows + ' rows');
})
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #nodejs #mysql #number #affected #rows
ADD COMMENT
Topic
Name
7+1 =