I have a question. Please, take a look at my script:
var dbconn = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '123',
database : 'mydb'
});
var query = dbconn.query("SELECT * FROM m02serials WHERE SerialNumber = '"+serialnumber+"'");
There is no error hints shown on my IDE for the above script. But, there is an error message just after the above line:
SyntaxError: Unexpected end of input
at Object.exports.createScript (vm.js:24:10)
at REPLServer.defaultEval (repl.js:137:25)
at bound (domain.js:250:14)
at REPLServer.runBound [as eval] (domain.js:263:12)
at REPLServer.<anonymous> (repl.js:393:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:884:20)
The above error message doesn't appear if I only write SELECT * FROM m02serials query (without WHERE). But, I want to put WHERE in the query. How is the right script to do this?
serialnumber, does it contain any quotes?serialnumberis a string, and it doesn't have quotes. The error still appears although I change the query into a plain string likeSELECT * FROM m02serials WHERE SerialNumber = 'AA12QWE''to"\")