Answers for "nodejs mysql getting the id of an inserted row"

0

nodejs mysql getting the id of an inserted row

//If you are inserting a row into a table with an auto increment primary key, you can retrieve the insert id like this:
connection.query('INSERT INTO posts SET ?', {title: 'test'}, function (error, results, fields) {
  if (error) throw error;
  console.log(results.insertId);
});
Posted by: Guest on May-01-2022

Code answers related to "nodejs mysql getting the id of an inserted row"

Code answers related to "Javascript"

Browse Popular Code Answers by Language