0
我必須使用response.writehead重定向到不同的頁面。我怎樣才能做到這一點在SQL查詢。如何在連接數據庫時使用node.js中的響應?
這是我的代碼。
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.
}
});
});
這不會服務我的目的。 Actuall我的問題是http://stackoverflow.com/questions/19567721/refresh-window-when-username-and-password-mismatch – Vardan