Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

nodejs delete in mysql

let mysql  = require('mysql');
let config = require('./config.js');

let connection = mysql.createConnection(config);

// DELETE statment
let sql = `DELETE FROM todos WHERE id = ?`;

// delete a row with id 1
connection.query(sql, 1, (error, results, fields) => {
  if (error)
    return console.error(error.message);

  console.log('Deleted Row(s):', results.affectedRows);
});

connection.end();
Source by hevodata.com #
 
PREVIOUS NEXT
Tagged: #nodejs #delete #mysql
ADD COMMENT
Topic
Name
6+2 =