Before I have made a test run and Everything was ok, but know when I am trying to insert a new static data it is saying that result is undefined.
How to solve this?
const mysql = require("mysql")
const con = mysql.createConnection({
host:"localhost",
user:"root",
password:"",
database:"magebitdb"
});
con.connect((err)=>{
if(err) throw err;
console.log("connected to DB");
// const sql =`INSERT INTO subscribers(email) VALUES (${email})`;
const sqlInsert = ("INSERT INTO subscribers(email) VALUES ?")
const values=[
"test value"
]
con.query(sqlInsert,[values],(err,result)=>{
console.log(`inserted data is: ${result}`);
console.log(values);
});
});