So I am trying to select rows based on user input, as shown below:
db.all(
'SELECT * FROM houses WHERE location LIKE "%$input%"',
{
$input: name,
},
(error, rows) => {
res.send(rows);
}
);
However, the database responds with an undefined value. What can I do?
You are not using query parameters properly. Consider:
It might be slightly more efficient to concatenate the variable in the js code: