I want to take out the result from mysql's connection.query and save it in global scope chain in nodejs
问题 I tried bringing out result by storing in variable current product. But I cant use it outside the function, so my array returns empty var connection = mysql.createConnection({ host: config.config.mysql.opencart_local.host, user: config.config.mysql.opencart_local.user, password: config.config.mysql.opencart_local.password, database: config.config.mysql.opencart_local.database }) var query_current_products = 'select * from table;'; var current_products = []; connection.connect(function(err) {