Created
February 28, 2014 14:49
-
-
Save hugeuser/9272401 to your computer and use it in GitHub Desktop.
PUT form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.formprocess = function (req, res) { | |
connection.query('INSERT INTO mocha_test_table VALUE'+ | |
'("'+req.body.user_name+'","'+req.body.email+'","'+req.body.fname+'","'+req.body.lname+'");', | |
function(err) { | |
if(err){ | |
console.log(err); | |
} | |
connection.query( | |
'SELECT * FROM mocha_test_table WHERE user_name="'+req.body.user_name+ | |
'" AND email="'+req.body.email+'";',function(err,results){ | |
if(results === null) { | |
res.render('../views/login'); | |
} else { | |
console.log(results); | |
res.render('../views/form', { | |
user_name:req.body.user_name, | |
email:req.body.email, | |
results: results, | |
}); | |
} | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment