在下面的代码中,expRow
,lanRow
和skillRow
变量最终为undefined
。如何从查询中获取这些值?我不想使用像左,右或内连接这样的mysql联合。我正在使用多个查询部分并获取这3个变量中的所有函数值。
var lan_Execute_innerQuery = "SELECT * FROM language LEFT JOIN languagedata ON language.l_id = languagedata.inner_join WHERE language.l_id = ?";
var exp_Execute_innerQuery = "SELECT * FROM experience LEFT JOIN experiencedata ON experience.exp_id = experiencedata.inner_join WHERE experience.exp_id = ?";
var skill_Execute_innerQuery = "SELECT * FROM skilltable LEFT JOIN skilldata ON skilltable.s_id = skilldata.inner_join WHERE skilltable.s_id = ?";
connection.query(skill_Execute_innerQuery,rows[0].s_id,function(err,skillRow,field){
if(err) throw err;
});
connection.query(exp_Execute_innerQuery,rows[0].exp_id,function(err,expRow,field){
if(err) throw err;
});
connection.query(lan_Execute_innerQuery,rows[0].l_id,function(err,lanRow,field){
if(err) throw err;
});
var html = view.compileFile('templates/profile.html')({
title:"Profile",
exitUser : true,
data : rows,
skillData : skillRow,
expData : expRow,
lanData : lanRow
});
res.writeHead(200,{'Content-Type':'text/html'});
res.end(html);