1

行オブジェクトを clubs 変数に渡せない理由を誰かに説明してもらえますか?

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : '',
  database : 'test'
});
var competition_feed = 'England';
var season_id = 2014;
var clubs = {};

connection.connect();

connection.query('SELECT * FROM clubs WHERE competition_feed=\''+competition_feed+'\' AND season_id='+season_id+';', function(err, rows, fields) {
    if (err) throw err;
    clubs = rows;
});

console.log(clubs);

connection.end();

変数とスコープについて何かが欠けているようです。助けてください :)

4

2 に答える 2