Guest User

Untitled

a guest
Jun 9th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. connection.query('insert into username (name) values ("msg")', function(err, rows, fields) {
  2.  
  3. if(!err) {
  4.  
  5.  
  6. } });
  7.  
  8. connection.query('insert into username (name) values '+ msg, function(err, rows, fields) {
  9.  
  10. if(!err) {
  11.  
  12.  
  13. } });
  14.  
  15. 'insert into username (name) values hello world'
  16.  
  17. var util - require('util');
  18. var mySql = util.format('insert into username (name) values ("%s")', 'hello world');
  19. connection.query(mySql, function(err, rows, fields) {
  20.  
  21. if(!err) {
  22.  
  23.  
  24. } });
  25.  
  26. const connection = mysql.createConnection({
  27. host: 'localhost',
  28. user: 'root',
  29. password: 'pass',
  30. database: 'db_name'
  31. });
  32.  
  33. connection.query(`INSERT INTO user_table (name, mail, pass) VALUES ('${user_name}', '${user_name}', '${user_name}');`, function (err, result, fields) {
  34. if (err) throw err;
  35. });
Add Comment
Please, Sign In to add comment