I am trying to delete a row in MYSQL table from NodeJS route. The query works fine by itself when i run it in MySQL Workbench. When executed from Node the row is not deleted. I don't get any error messages on either server or client side. Here is the code:
router.post('/bid_delete', async (req, res) => {
let bid_no = req.body['bid_no']
let qrBids= "SET SQL_SAFE_UPDATES = 0; DELETE FROM bids_hdr WHERE
bid_gen_id ='" + bid_no + "';"
await pool.query( qrBids, (err, result) => {
if (err) {
res.send(err)
} else {
res.json({success : true})
}
});
})
Thanks in advance for any guidance.
pool.query(). Execute them sequentially.qrBidsstring? JavaScript doesn't allow newlines in string literals (you can use them in template literals, but not single-quoted or double-quoted literals).