Reputation: 67
I'm trying to check in a NodeJS query where a user his id is e.g. 1 and his private_number is 25, the following code doesn't work.
query('SELECT * FROM `users` WHERE `user` = '+pool.escape(user)+', `private_number` ='+pool.escape(number), function(err, row) { //get if the player has a query with the same code
});
Is this even properly possible?
Upvotes: 0
Views: 30
Reputation: 107
you can use template strings
query(`SELECT * FROM users WHERE user = ${pool.escape(user)} AND
private_number = ${pool.escape(number)}`), function(err, row) {
})
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
P.S. when you have multiple conditions in WHERE
clause you need to 'connect' them with logical operator like AND
or OR
Upvotes: 1