https://github.com/mysqljs/mysql #getting-the-id-of-an-serted-row beskriver lösningen utmärkt:
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-serted-row beskriver lösningen utmärkt:
connection.query('INSERT INTO posts SET ?', {title: 'test'}, function(err, result, fields) {
if (err) throw err;
console.log(result.insertId);
});