I am getting the following error when trying to insert multiple inserts based on one form
"sql: "INSERT INTO ( pokemon (pokemonname) VALUES ('sadfasd'), INSERT INTO location (locationname) VALUES ('asdfasdf'), INSERT INTO primarymove (primarymovename) VALUES ('asdf'), INSERT INTO type (typename) VALUES ('2'))"
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '( pokemon (pokemonname) VALUES ('sadfasd'), INSERT INTO location (locationname) ' at line 1","
And below is my post request
router.post('/', function(req, res){
var mysql = req.app.get('mysql');
var sql = "INSERT INTO pokemon (pokemonname) VALUES (?), INSERT INTO location (locationname) VALUES (?), INSERT INTO primarymove (primarymovename) VALUES (?), INSERT INTO type (typename) VALUES (?)";
var inserts = [req.body.pokemonname, req.body.locationname, req.body.primarymovename, req.body.typename];
sql = mysql.pool.query(sql, inserts, function(error, results, fields){
if(error){
res.write(JSON.stringify(error));
res.end();
} else{
res.redirect('/pokemon');
}
});
});
I am going to assume it has to do with my multiple INSERT INTO requests, I am basically trying to do multiple insert statements going to various different tables. Or is it not possible?