Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mysql = require('mysql');
- var con = mysql.createConnection({
- host: "localhost",
- user: "root",
- password: "",
- database: "test"
- });
- con.connect(function(err) {
- if (err) throw err;
- //Update the address field:
- var sql = "UPDATE users SET name = 'lol2' WHERE name = 'lol'";
- con.query(sql, function (err, result) {
- if (err) throw err;
- console.log(result.affectedRows + " record(s) updated");
- });
- });
Add Comment
Please, Sign In to add comment