I have a function that supposed to return a first_name and I manipulate it in the javascript file. However, the function returns "undefined". The main idea is to retrieve first_name value from mysql table (people) and compare it with a given name. Here is the function that I use:
function getFirstname() {
connection.query('SELECT first_name FROM people WHERE id = 14', function(err, rows) {
if (err) throw err;
return rows;
});
}