From d83d73ce49f6dcd810fcea8ddf96bb17e8fa9d81 Mon Sep 17 00:00:00 2001 From: llopis15 Date: Fri, 12 Mar 2021 13:34:06 +0100 Subject: [PATCH] insertDB --- db/insertDB.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 db/insertDB.js diff --git a/db/insertDB.js b/db/insertDB.js new file mode 100644 index 0000000..42525aa --- /dev/null +++ b/db/insertDB.js @@ -0,0 +1,13 @@ +const con = require('./connect') + +function insertDB(barcode, shelving, level){ +con.con.connect(function(err) { + if (err) throw err; + console.log("Connected!"); + var sql = `INSERT INTO vn.smartTag (code, shelvingFk, level) VALUES (${barcode}, ${shelving}, ${level})`; + con.con.query(sql, function (err, result) { + if (err) throw err; + console.log("1 record inserted"); + }); + }); +} \ No newline at end of file