Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lastMsg = "Message received"; // recebe a msg
- var mysql = require('mysql'); //
- var con = mysql.createConnection({
- host: "localhost",
- user: "yourusername",
- password: "yourpassword",
- database: "mydb"
- });
- con.connect(function(err) {
- if (err) throw err;
- console.log("Connected!");
- var sql = "INSERT INTO mensagens (textomsg) VALUES (lastMsg)";
- con.query(sql, function (err, result) {
- if (err) throw err;
- console.log("1 record inserted");
- });
- });
Add Comment
Please, Sign In to add comment