Answers for "node mysql connection.escape"

6

node js mysql escape string

// Escape values:

let escaped = mysql.escape('myString');

// or

mysql.query(
  "SELECT * FROM `table` WHERE `str1`=? AND `str2`=?",
  ['myString1', 'myString2'],
  (err, result)=>{}
);

// Escape identifiers:

mysql.query(
  "SELECT * FROM ??",	// note the double ?
  ['tablename'],
  (err, result)=>{}
);
Posted by: Guest on June-01-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language