我必须使用 response.writehead 重定向到不同的页面。我如何在 sql 查询中执行此操作。
这是我的代码。
socket.on('login_check', function(email, pwd) {
connection.query("SELECT id,user_type FROM user WHERE email = '"+email+"' AND password = '"+pwd+"'ORDER BY name ",
function (error, results, fields) {
if (error) {
console.log(error);
}
if (results[0]) {
// some code
} else {
// Have to use response.writehead here. Please guide how to do this. If i use it here directly then it will give response is undefined error.
}
});
});