https://github.com/mysqljs/mysql #getting-the-id-of-an-inserted-row popisuje řešení dokonale:
connection.query('INSERT INTO posts SET ?', {title: 'test'}, function(err, result, fields) {
if (err) throw err;
console.log(result.insertId);
});
https://github.com/mysqljs/mysql #getting-the-id-of-an-inserted-row popisuje řešení dokonale:
connection.query('INSERT INTO posts SET ?', {title: 'test'}, function(err, result, fields) {
if (err) throw err;
console.log(result.insertId);
});