Here I insert user details username,emailid and contactno and userid is primary key of user table.
My query is when i insert duplicate username or emailid and if duplicate record is heard in the table, it does not allow the record to be inserted how it is possible ?
app.js
app.post('/saveNewUserDetails',function(req,res){
var form = new multiparty.Form();
form.parse(req, function(err, fields, files){
connection.query("INSERT INTO user (username,emailid,contactno) VALUES (?,?,?)", [fields.username,fields.emailid,fields.contactno] , function (error, results, fields) {
if (error) throw error;
res.send({
'status':'1',
'success': 'true',
'payload': results,
'message':'New user Is saved'
});
});
});
});
User
userid(primary key) username emailid contactno
1 user-1 [email protected] 1234567890
2 user-2 [email protected] 1234444444