I am trying to execute that query using mysql2:
const [[questions]] =
await db.promise().execute(
'SELECT * FROM `questions` WHERE `questions`.`topic` LIKE ?',
['%' + text + '%']
);
but get nothing from database.
Then I tried this:
const [[questions]] =
await db.promise().execute(
"SELECT * FROM `questions` WHERE `questions`.`topic` LIKE '?'",
['%' + text + '%']
);
and still nothing.
How should I make prepared statement here?