Hello y need send variable in my request sql. For searching value in my database
var cent = "search";
con.connect(function (err) {
if (err) throw err;
var sql ="SELECT * FROM cadito.activitys WHERE description like ?";
//Send an array with value(s) to replace the escaped values:
con.query(sql, [%cen%], function (err, result) {
console.log(global.re = JSON.stringify((result)));
});
});
My problème syntaxe error.
Thank for help me.
My log db_conn.js:20 con.query(sql, [%cent%], function (err, result) { ^
SyntaxError: Unexpected token '%' ?[90m at wrapSafe (internal/modules/cjs/loader.js:979:16)?[39m ?[90m at Module._compile (internal/modules/cjs/loader.js:1027:27)?[39m ?[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)?[39m ?[90m at Module.load (internal/modules/cjs/loader.js:928:32)?[39m ?[90m at Function.Module._load (internal/modules/cjs/loader.js:769:14)?[39m ?[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)?[39m ?[90m at internal/main/run_main_module.js:17:47?[39m