1

我正在使用玛丽亚数据库。这些值没有插入到数据库中。我将值作为 Json 数组从我的路线传递。

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};

得到这个值的函数是:

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;

它返回如下错误:

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 }
4

0 回答 0