I want to dynamically create a Table in MySQL from Node.js
con.query('CREATE TABLE ?', req.params.username + '(id INT(100) NOT NULL
AUTO_INCREMENT, name TINYTEXT, PRIMARY KEY(id))', function (err, result) {
if (err) console.log(err);
else console.log('Table created ' + result);
});
When the query is hard-coded like ,
con.query('CREATE TABLE Sample (id INT(100) NOT NULL AUTO_INCREMENT, name
TINYTEXT, PRIMARY KEY(id))', function (err, result) {
if (err) console.log(err);
else console.log('Table created ' + result);
});
It works.
So, my question is how to create a table dynamically ?