1

I am using Maria db. The values are not getting inserted into database. I am passing the value as Json array from my route.

var insertValues = {'username': username, 'firstname': firstname, 'lastname': lastname, 'email': email,
                        'password':password, 'profileType': profileType,'userType': userType, 'gcmId': gcmId,
                        'deviceName': deviceName, 'osType': osType, 'osVersion': osVersion,'isBlocked':isBlocked,
                        'isActive':isActive, 'ofActive':ofActive};

The function that getting this value is:

function registerUser(insertValues,callback)
{
    model.client.query('insert into users set ?',insertValues,function(err) {
      if(!err)
            callback({"success":'1'});
        else
            console.log(err);
            callback({"success":'0'});
    });
}
module.exports.registerUser=registerUser;

It returning an error like this:

Maria Db Connected at : 128.199.242.240
{ [Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1] code: 1064 }
halfer
  • 19,824
  • 17
  • 99
  • 186
midhun k
  • 1,032
  • 1
  • 15
  • 41

0 Answers0