Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229617

Back-end and Front-end to Insert into MySql database with node.js on remote server from Ionic2

$
0
0

Hi, @lado

For inserting in my sql try like below code :

app.post('/addpost1',function(req, res){
  console.log(req.body);
  var sql= "INSERT INTO ragisters (fname, lname, email, password, gender, bdate) VALUES ('"+req.body.fname+"', '"+req.body.lname+"','"+req.body.email+"','"+req.body.password+"', '"+req.body.gender+"','"+req.body.bdate+"')"
  console.log(sql)
  db.query(sql, function(err , result) {
     if (err) throw err;
     else
      res.json({msg:"Data inserted sucessfully...!",status: 200, code : 0});
  })
})

thanks


Viewing all articles
Browse latest Browse all 229617

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>