I am gathering data from a webpage visitor and putting it into a JavaScript object I create. But later I want to be able to reference the data they entered.
I have acce
Yes Actually It can be done.
con.connect(function(err){
var sql = "INSERT INTO books SET ?"; //books --
if(err) console.dir("Error: "+err.message);
var values = {
"bname": "Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future",
"author": "Elon Musk",
"genre": "Technology",
"bookcount": "5"
};
con.query(sql, [values], function(err, result){
if (err) throw err;
else console.dir("Successfully inserted the row in table.");
console.log(result);
});
});
But, along with this you have to satisfy these points,
value
should be object i.e., value={ "name":"property" }Hope it helps.