angularjs - How to use select statement with where condition on node.js -
> trying provide login credentials email , password using postgres database table.
postgres database tables. when records should send 200 status page.am getting error on query. kindly me out how use select condition. missing syntax.
getuser : function(req, res) { var pg = require('pg'); var constring = process.env.database_url || "postgres://test:test@localhost:5432/wallet"; var client = new pg.client(constring); client.connect(); console.log(req.query.email_id); console.log(req.query.user_password); var query = client.query("select * pp_user_profile email_id ="+req.query.email_id+ "and" + "user_password=" +req.query.password); query.on("end", function (result) { client.end(); res.writehead(200, {'content-type': 'text/plain'}); res.write('success'); res.end(); }); },
try below syntax:
"select * pp_user_profile email_id = '"+req.query.email_id+"' , user_password= '"+req.query.password+"'";
Comments
Post a Comment