Answer the question
In order to leave comments, you need to log in
Prepared query not working?
Hello, please tell me why the prepared request is not working
const writeData = await getDataDB('INSERT INTO test (ownId, email, ip, category, productId) VALUES (?, ?, ?, ?, ?)', ["1212", "[email protected]", "12.12.12", "test", "1"]);
const writeData = await getDataDB('INSERT INTO test (ownId, email, ip, category, productId) VALUES ("12324", "[email protected]", "12.12", "test", "11")');
const getDataDB = (q, p = '')=>{
return new Promise((resolve,reject)=>{
pool.query(q, [p], (err,result)=>{
if(err) reject(err);
resolve(result);
});
});
};
const writeData = await getDataDB(`INSERT INTO test (ownId, email, ip, category, productId) VALUES ("123245", ${email}, "12.12", "test", "11")`);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question