0

This code working

let result = await mysqlconnection.query("SELECT * from table");

result contains some info without actual result from MySQL, but have connection and config properties; result[0] returns null, but I need data from MySQL, so when I tried using

mysqlconnection.query("SELECT * from table", function(err, results){
    console.log(results);
});

it prints what I need, but asynchronically. My question is how to combine synchronous execution and get results?

VityaSchel
  • 579
  • 7
  • 18

1 Answers1

0

Try this:

mysqlconnection.query( 'SELECT * FROM table' ).then( result => {
   // ... use the result ...
} )
Blaze
  • 84
  • 5