【发布时间】:2014-12-02 08:33:10
【问题描述】:
我无法访问 MySQL 查询回调中的即将到来的_matches 数组,这是怎么回事?
我在 console.log(upcoming_matches[1]); 上收到“TypeError: Cannot read property '1' of null”错误消息表示由于某种原因正在重置变量的行(猜测,我对 Javascript 不是很有经验)?
var regex = regex code..
while ((upcoming_matches = regex.exec(body)) != null) {
HLTVID = upcoming_matches[1].split("-");
connection.query('SELECT * FROM `csgo_matches` WHERE HLTVID=' + HLTVID[0], function(err, rows, fields) {
if (err) throw err;
console.log(upcoming_matches[1]);
});
}
【问题讨论】:
标签: javascript node.js