I'd like to insert these data name, title, body, timestamp, img_url to a new column in MySQL. How do I achieve that.
static post(name) {
return db.execute('INSERT INTO tablename (name) VALUES (?)', [name]);
}
I'd like to insert these data name, title, body, timestamp, img_url to a new column in MySQL. How do I achieve that.
static post(name) {
return db.execute('INSERT INTO tablename (name) VALUES (?)', [name]);
}
const mysqlConnection = require('mysql');
const conn = mysql.createConnection({...});
var query = "INSERT INTO your_table (name, email, n) VALUES ?";
var values = [
['test1', '[email protected]', 1],
['test2', '[email protected]', 2],
];
conn.query(sql, [values], function(err) {
if (err) throw err;
conn.end();
});