I have this function to register a new user in the DB:
this.registerUser = function(username,password,name,picture){
client.query('INSERT INTO' + USER +'SET username=?,passsword=?,name=?,picture=?',[username,password,name,picture],
function(err){
if(err){
throw err;
}
});
}
This is the line used to call the function from another module:
var data = new db.dataBase('root','root');
data.registerUser("a","a","a","a");
and this is the MySQL table:
client.query(
'CREATE TEMPORARY TABLE IF NOT EXISTS '+USER+
'(username VARCHAR(255), '+
'password VARCHAR(255), '+
'name VARCHAR(255), '+
'picture VARCHAR(255), '+
'PRIMARY KEY(username))'
);
and for some unknown reason(for me) I am getting this error:
Error: You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'username='a',password='a',name='a',picture='a'' at line 1
I have no idea what I am doing wrong here, please help.
Thank You!
I think its problem with spaces,:
Hope it helps