I am using @el3um4s/node-mdb package, so when i sql the commands
SELECT *
FROM API_DATA
WHERE TRNo = 1002
AND VehicleNo = 'AP16TT1002'
like this i am getting correct query result but when i tried adding variables to it like
SELECT *
FROM API_DATA
WHERE TRNo = ${trNo}
AND VehicleNo = '${vehicleNo}'
by taking them from url, it is returning empty
const location = req.query.location;
const vehicleNo = req.query.VehicleNo; // Use the correct case for VehicleNo
const trNo = req.query.TRNo;
if (vehicleNo) {
sql += ` AND VehicleNo='${vehicleNo}'`;
}
if (trNo) {
sql += ` AND TRNo='${trNo}'`;
}
above is some reference code if you need
this is the code of execution of sql after i add all params
const result = await query.sql({
database,
sql,
});
console.log(result)
Also url is not the first problem here, problem is when i console sql command which it becomes after getting from url is same
url => localhost:3000/?VehicleNo=AP16TT2001&TRNo=1002