Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update & Delete Query missing '.' between 'where()' and 'execute()' #90

Open
alexandercharlie opened this Issue · 0 comments

1 participant

@alexandercharlie

Update Query Corrected Here:

var mysql = require('db-mysql');
new mysql.Database({
hostname: 'localhost',
user: 'user',
password: 'password',
database: 'test'
}).connect(function(error) {
if (error) {
return console.log('CONNECTION error: ' + error);
}
this.query().
update('users').
set({ 'name': 'New Name' }).
where('id = ?', [ 1 ]).
execute(function(error, result) {
if (error) {
console.log('ERROR: ' + error);
return;
}
console.log('RESULT: ', result);
});
});

Delete Query Corrected Here:

var mysql=require('db-mysql');
new mysql.Database({
hostname:'localhost',
user:'root',
password:'ok',
database:'test'
}).connect(function(error){
if(error){
return console.log('CONNECTION error: '+error);
}
this.query().
delete().
from('NODEDB').
where('id=?',[1]).
execute(function(error,result){
if(error){
console.log('ERROR: '+error);
return;
}
console.log('RESULT: ',result);
});

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.